static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@""];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
//cell.backgroundView = [[[CustomCell alloc] init] autorelease];
cell.selectedBackgroundView = [[[CustomCell alloc] init] autorelease];
// At end of function, right before return cell:
cell.textLabel.backgroundColor = [UIColor clearColor];
// Configure the cell.
UILabel *myLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(-30, 3, 300, 22)];
UILabel *myLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(10, 22, 310, 200)];
UILabel *myLabel3 = [[UILabel alloc] initWithFrame:CGRectMake(0, 170, 300, 20)];
Book *aBook = [appDelegate.books objectAtIndex:indexPath.row];
myLabel1.text=aBook.title;
myLabel2.text=aBook.description;
myLabel3.text=aBook.pubDate;
NSString *desc = aBook.description;
if ([desc isEqualToString:nil]) {
NSLog(@"nullll lll ");
}
//myLabel2.textAlignment=UITextAlignmentCenter;
myLabel2.numberOfLines=5;
myLabel2.textColor=[UIColor blueColor];
myLabel2.lineBreakMode=UILineBreakModeWordWrap;
myLabel2.font=[UIFont systemFontOfSize:14];
myLabel3.numberOfLines=1;
myLabel1.numberOfLines=1;
myLabel1.textColor=[UIColor redColor];
myLabel1.font=[UIFont systemFontOfSize:20];
myLabel1.shadowColor=[UIColor redColor];
myLabel1.backgroundColor=[UIColor grayColor];
[cell.contentView addSubview:myLabel1];
[cell.contentView addSubview:myLabel2];
[cell.contentView addSubview:myLabel3];
salut les gars! J'ai ce code suivant, je veux l'afficher à partir du fichier XML. maintenant son travail mais la hauteur de la rangée statique. si le fichier xml ne contient pas de données, il le laisse vide. donc je veux changer la hauteur de ligne en fonction des données que je fournis en utilisant la mylabel1,2,3.texthauteur de ligne dynamique
pls laissez-nous un certain niveau de base. Je suis un novice à l'iphone, je n'ai pas été désolé – Splendid