StoryBoard设置Cell中的Label自适应高度

来源:互联网 发布:小丸压制软件 编辑:程序博客网 时间:2024/06/06 19:31
1.在StoryBoard中给Cell上的label添加约束(Constraints),不要给高添加约束
2.设置label的Text.
3.//设置UItableViewCell自适应Storyboard中的label的高度
    self.tableView.rowHeight = UITableViewAutomaticDimension;
    //Cell设置一个预留高度(预留高度一定要给,大概给个高度就可以)
    self.tableView.estimatedRowHeight = 40;
0 0
原创粉丝点击