xcode warning "estimated section footer height before ios 11" what does it mean?

Viewed 1660

Does anyone know the meaning of this warning? I don't understand the problem it's describing. If I provided an estimated height when I shouldn't have, why is it a problem?

Here's some more info and screenshots: screenshot of header / footer height warnings in xcode screenshot of footer height and estimates in xcode

My target is iOS 10, because I want to support older devices.

In the tableViewController, I have overridden both heightForFooterInSection and estimatedHeightForFooterInSection (they each provide the same value, one of 2 possible heights)

I'm using this method to load the view into the footers: Swift - How creating custom viewForHeaderInSection, Using a XIB file?

2 Answers

You should set 0 to Estimate and implement 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

I add this answer that suppressed the warning :

  • suppress the tags in the source code of the xib file

    <tableView ... estimatedSectionHeaderHeight="44" ... estimatedSectionFooterHeight="-1" ...

These 2 tags may appear if you a table view in an old project or if you change table style from Plain to other style.

Tested with xCode 13.4.1 with iOS deployment target set to iOS 10.1 (ie before iOS 11)

Related