我将我的 Xcode 和 Swift 1.2 一起更新到了 6.3,然后我进行了转换。
除了表格视图的动态行高之外,一切正常。我在 3 个完全不同的表视图上有这些,所以它可能不是影响这个 bug 的其他因素。
我将所有表格视图设置为:
tableView.rowHeight = UITableViewAutomaticDimension
并且我所有的 xib 文件都受到了适当的约束。
有任何想法吗?
我将我的 Xcode 和 Swift 1.2 一起更新到了 6.3,然后我进行了转换。
除了表格视图的动态行高之外,一切正常。我在 3 个完全不同的表视图上有这些,所以它可能不是影响这个 bug 的其他因素。
我将所有表格视图设置为:
tableView.rowHeight = UITableViewAutomaticDimension
并且我所有的 xib 文件都受到了适当的约束。
有任何想法吗?
我也简单地将 UITableViewAutomaticDimension 添加到estimatedrowforindexpath 中。您可以在BEAM 应用程序上看到它是如何工作的(在“人员”类别下)。
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return UITableViewAutomaticDimension;
}
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
return UITableViewAutomaticDimension;
}
需要提供估计的行高。
estimatedHeightForRowAtIndexPath:
除非必要,否则最好不要实施。
estimatedRowHeight
只要你能想出一个价值就更便宜
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 30 //Provide any appropriate value