iOS8 tableView的Cell高度自适应开发

1.在- (void)viewDidLoad中设置:

//估计高度为81
self.tableView.estimatedRowHeight = 81.0f;
//自适应高度
self.tableView.rowHeight = UITableViewAutomaticDimension;
2.XIB自己定义的Cell的autoLayout的时候注意自适应的内容的Label或者TextField等等的约束。

3.当然不须要实现设置高度的方法了。

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


4.执行效果:


---end

posted on 2017-06-29 16:23  blfbuaa  阅读(128)  评论(0编辑  收藏  举报