我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 设置运行时:
这种行为的原因是什么?