Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 377
bluegreen Avatar asked Jan 03 '19 23:01

bluegreen


1 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

like image 198
ChikabuZ Avatar answered Oct 24 '22 03:10

ChikabuZ