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