Tableview 具有三种具有动态高度的自定义单元格。我想在 cellForRowAtIndex()
方法中使用 tableView.rowHeight = 100
来设置行高。
这样合适吗?
最佳答案
1.为原型(prototype)单元格定义自动布局约束 2.指定 TableView 的estimatedRowHeight 3.将表格 View 的rowHeight设置为UITableViewAutomaticDimension
在 viewDidLoad 中执行这些代码
tableView.estimatedRowHeight = 68.0(原型(prototype)单元格的实际高度)
tableView.rowHeight = UITableViewAutomaticDimens
关于ios - 在 cellForRowAtIndexPath 为不同的行高设置行高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37279963/