可视化编程中----cell的自适应高度

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

Joke *joke = self.dataArray[indexPath.row];


NSString *content = joke.joke;

self.customCell.contentLabel.text = content;
self.customCell.bounds = CGRectMake(0, 0, self.view.frame.size.width, self.customCell.frame.size.height);

[self.customCell updateConstraintsIfNeeded];
[self.customCell layoutIfNeeded];
CGFloat height = [self.customCell systemLayoutSizeFittingSize: UILayoutFittingCompressedSize].height + 1;
return height;

}

posted @ 2015-03-31 13:26  沈红榜  阅读(166)  评论(0编辑  收藏  举报