ios - xcode 警告 "estimated section footer height before ios 11"是什么意思?

标签 ios xcode compiler-warnings suppress-warnings uitableviewsectionheader

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

以下是更多信息和屏幕截图: screenshot of header / footer height warnings in xcode screenshot of footer height and estimates in xcode

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

在 tableViewController 中,我覆盖了 heightForFooterInSectionestimatedHeightForFooterInSection(它们都提供相同的值,2 个可能的高度之一)

我正在使用此方法将 View 加载到页脚中:Swift - How creating custom viewForHeaderInSection, Using a XIB file?

最佳答案

您应该将0设置为Estimate并实现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
    }
}

Size Inspector image

关于ios - xcode 警告 "estimated section footer height before ios 11"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54031018/

相关文章:

ios - didEnterRegion 中的 iBeacon major 和 minor 值

Xcode 不会与 FLUTTER_BUILD_NAME 一起使用

c - 两个警告 : assignment makes integer from pointer without a cast and comparison between pointer and integer

ios - 更改navigationController的背景颜色时,为什么状态栏(尽管设置为“黑色不透明”)会变成灰色?

ios - 当 UIViewController.view 清晰时,阴影出现在 subview 后面

iphone - 将 iPhone 应用程序部署到 AppStore

c++ - 在 Xcode 5.1 中从虚幻引擎 4 编译 C++ 时出现代码签名错误

xcode - CoreAudio AUGraph 没有声音

c++ - 覆盖单个文件的编译标志

c++ - 比较对 int 和 unsigned 的引用时发出警告,但如果将 const(无引用)与 g++/msvc 进行比较则没有警告