获取数据后,我重新加载表格 View 。我使用自动尺寸
不要像下面那样覆盖 heightForRowAtIndexPath
self.tableView.estimatedRowHeight = 200;
self.tableView.rowHeight = UITableViewAutomaticDimension;
iOS9 一切正常。但是在 iOS8 中看起来像下面的链接,直到滚动。
iOS8 appear
我试过:
[_tableView setNeedsLayout];
[_tableView layoutIfNeeded];
[_tableView reloadData];
之后在 iPhone 6Plus 中出现其他 ui 问题。 最佳答案
尝试重新加载 viewDidappear
中的数据或 viewWillappear
并检查您的约束是否完美,因为 UITableViewAutomaticDimension
强烈推荐自动布局。
更新 :
根据评论尝试在 cellforrowAtindexpath
中添加这两行
[cell layoutIfNeeded];
[cell updateConstraintsIfNeeded];
为了使 UITableViewAutomaticDimension 工作,您必须设置所有相对于单元格容器 View 的左侧、右侧、底部和顶部约束。如果你错过了这样的然后检查
希望这个
会有所帮助:)
关于ios - UITableViewAutomaticDimension 在滚动 iOS8 之前不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36743612/