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

2

6

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?

Dorise answered 3/1, 2019 at 23:5 Comment(2)
Does this help with anything? twitter.com/smileyborg/status/871857245289562112?s=21Constantine
This can appears if you change table view style from plain to other value. Even going back to plain does not reset it (may be some tags are added in Xib file)Virginiavirginie
C
8

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

Cryptology answered 26/8, 2019 at 8:59 Comment(1)
thanks for your answer. I was actually just wondering what the meaning of the warning was. I had already figured out how to get the layout to work, but i'm not even working on that project anymore. Hope this helps someone else thoughDorise
V
0

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)

Virginiavirginie answered 16/9, 2022 at 14:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.