xcode警告“估计iOS 11之前的部分页脚高度”是什么意思?

Bra*_*rad 5 xcode compiler-warnings suppress-warnings ios uitableviewsectionheader

有人知道这个警告的意思吗?我不明白它所描述的问题。如果我在不应该提供的时候提供了估计的身高,为什么会有问题?

以下是更多信息和屏幕截图: Xcode中页眉/页脚高度警告的屏幕截图 Xcode中的页脚高度和估算值的屏幕截图

我的目标是iOS 10,因为我想支持较旧的设备。

在tableViewController中,我同时覆盖了heightForFooterInSectionestimatedHeightForFooterInSection(它们各自提供相同的值,是2种可能的高度之一)

我正在使用此方法将视图加载到页脚中:Swift-如何使用XIB文件创建自定义viewForHeaderInSection。

Chi*_*buZ 7

你应该设置0Estimate并实施heightForHeaderInSection

func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
    let headerHeight: CGFloat = 40
    if #available(iOS 11.0, *) {
        tableView.estimatedSectionHeaderHeight = headerHeight
        return UITableView.automaticDimension
    } else {
        return headerHeight
    }
}
Run Code Online (Sandbox Code Playgroud)

尺寸检查器图像