如果你想cell
用多个显示你的文本,那么你也可以穿上UILabel
,cell.contentView
并给出labelName.numberOfLines = 0
显示文本锡多行。
对于 EX:
UILabel *lbltitle = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 270, 35)];
lbltitle.backgroundColor = [UIColor clearColor];
NSString *originalString = @" Indian version of this popular search engine. Search the whole web or only webpages from India. Interfaces offered in English, Hindi, Bengali, Telugu, Marathi";
lbltitle.text= originalString;
lbltitle.font =[UIFont fontWithName:@"Arial-BoldMT" size:16];
lbltitle.textAlignment = UITextAlignmentLeft;
lbltitle.numberOfLines = 0;
lbltitle.textColor=[UIColor blackColor];
[cell.contentView addSubview:lbltitle];
上面的代码放在中间的cellForRowAtIndexPath
方法上
if(cell == nil)
{
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
// Put here Label Code
}
Alos 阅读此如何在 iOS 中创建多行表格单元格?