【发布时间】:2017-11-25 12:35:19
【问题描述】:
我的一个屏幕中有UITableView。它显示具有动态高度的部分标题和行。
当我从 Xcode8.3 迁移到 Xcode-9 beta 时,此设置存在两个问题。
1 标题视图高度损坏
2 断行的动态高度
我已将表格视图设置为:
然后我有自定义单元格
代码如下:
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return //dynamically calculated height according to msg text
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 30
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerHeight:CGFloat = tableView.sectionHeaderHeight
let headerView = HeaderView(frame: CGRect(x: 0, y: 0, width: tableView.width, height: headerHeight), withHeaderLable: "Date/Day of msg")
return headerView
}
即使有多行消息,这在 Xcode8.3 中也能完美运行,但在 Xcode9 beta 中被破坏为: 当我在 Xcode9 beta 中使用 Swift3.2 设置运行时:
当我在 Xcode9 beta 中使用 Swift4 设置运行时:
这种行为的原因是什么?
【问题讨论】:
-
你为什么使用测试版?
-
@elk_cloner 这应该是个问题,为什么要使用测试版。这是一项挑战即将到来的技术的举措。如果这真的是苹果的bug,那么面对这样的挑战并找到合适的解决方案对我们会有帮助
标签: ios uitableview autolayout row-height xcode9-beta