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?

bluegreen
  • 434
  • 3
  • 14
  • Does this help with anything? https://twitter.com/smileyborg/status/871857245289562112?s=21 – Callum Jan 04 '19 at 04:53

1 Answers1

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

ChikabuZ
  • 9,613
  • 5
  • 61
  • 80
  • 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 though – bluegreen Aug 26 '19 at 23:48