iOS 自动计算高度

这个新特性,意味着View被Autolayout调整frame后,会自动拉伸和收缩SupView。

具体到Cell,要求cell.contentView的四条边都与内部元素有约束关系。

 

在TableViewController里

- (void)viewDidLoad {

    [super viewDidLoad];

    

//添加这两行代码

    self.tableView.estimatedRowHeight = 44.0f;

    self.tableView.rowHeight = UITableViewAutomaticDimension;

 

}

posted on 2016-12-05 11:49  举个例子yi聪聪  阅读(136)  评论(0编辑  收藏  举报

导航