I have a UITableView embedded in another view like so:
The navigation controller is displayed modally, so its layout should be full screen and not depend on any other parts of the storyboard. If have set up the upper part of the profile view with fixed auto-layout constraints like so:
So basically, when the screen is larger, the container view should fill the remaining space.
In the container view, I embedded a Table View (including the appropriate controller). To make the issue more visible, I gave the container view a green background and the table view a blue one (that's why the section heading is slightly blue). Of course, I would expect the table view to fill the entire container view. But this only happens partially:
So the table view does fill the complete container view (the table view's background color is blue) but the section header is positioned to low. If I scroll down, the section header stays at the same position, but the cells move up and are displayed above it:
I already tried checking and unchecking the "Extended Edges" checkboxes of the table view controller that control whether it extends "Under Top Bars", "Under Bottom Bars" and "Under Opaque Bars", but that did not help. It looks as if the table view leaves space for the navigation bar and status bar, but it shouldn't and I don't understand how I can make it lay out the section header and cells correctly.
Any ideas why that is and how I can fix it?
This can be fixed by unchecking the "Under Top Bars" box in IB for the controller that has the container view in it, not the table view controller. It doesn't seem correct that you should have to do this, since, you would think that having the main view (in the container controller) extend under the navigation bar wouldn't make the embedded table view behave the way it does.
Disabling "Adjust scroll view insets" of the containing view also helps here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With