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];
嗨,大家好!我有以下代码,我想从xml文件中显示这个。现在它的工作,但静态行高。 如果xml文件没有数据,则将其保留为空白。所以我想根据我提供的数据使用mylabel1,2,3来更改行高。文本动态行高
请让你的电话一些基本的水平。我是新手到iPhone,我没有得到你对不起 – Splendid 2011-01-11 18:33:00