开发者

how to fix text to show in tableview cell i niphone app

I am showin开发者_StackOverflow中文版g text in tablevew. Some text is crossing cell. I want to show text as par cell size limit and I am using customView for cell.

How will I do this. Here is part of cell initialization code.

 {
    .....

CustomTableCellview *cell = (CustomTableCellview *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if(cell == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"CustomTableCellview" owner:self options:nil];
    cell = tblCell;

}

cell.titleOfPost.text = [tableList objectAtIndex:indexPath.row];
.......
}


Set the frame of cell.titleOfPost to something the same size or smaller than the Cell Frame like this:

cell.titleOfpost.frame = CGRectMake(0,0,cell.frame.size.width,cell.frame.size.height);


Set this to YES - @property(nonatomic) BOOL adjustsFontSizeToFitWidth for the cell.textLabel

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜