UITableView extra space at bottom

Ok, I got it.

The "Adjust Scroll View Insets" was marked on my viewController (not my tableView).

Here is an answer with a detailed explanation


@urgentx's answer did most of what I wanted but didn't get all the way there. I'm in a similar situation (upside down UITableView for a chat app) however their suggestion fully disables safe area behavior which isn't desirable on devices like the iPhone X because it means the tableview will be clipped by both the home indicator and any top navigation bars.

I did the following in order to make the tableview still correctly avoid safe areas while inverted:

override func viewDidLoad() {
    super.viewDidLoad()
    self.automaticallyAdjustsScrollViewInsets = false
    self.tableView.contentInsetAdjustmentBehavior = .never
}

and then:

override func viewWillLayoutSubviews() {
    super.viewWillLayoutSubviews()
    //fetch the safe area in layoutSubviews since this it's possible that they can change when the device is rotated
    let safeArea = self.tableView.safeAreaInsets
    //insets are **flipped** because the tableview is flipped over its Y-axis!
    self.tableView.contentInset = .init(top: safeArea.bottom, left: 0, bottom: safeArea.top, right: 0)
}

This in essence replicates contentInsetAdjustmentBehavior = .automatic behavior but with the insets flipped across the Y-axis.


In my case tableView was created programmaticaly and I had to set tableView.estimatedRowHeight to make the space disappear