iOS8 tableView的Cell高度自适应开发

来源:互联网 发布:医疗优化站不收录 编辑:程序博客网 时间:2024/05/16 10:23

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

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

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

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


4.运行效果:


---end

0 0
原创粉丝点击