I have a TableView
inside a ViewController
.
I made the TableView
stretch to the View SuperMargings (with constraints) and disabled all SafeArea
Inset options but my TableView
is still under the SafeArea
when I run my project.
How can I make my TableView
go full height on iPhones with notch?
You can disable safe area layout guide from storyboard for particular view controller. Select View Controller -> File Inspector (first tab) -> Use safe area layout guides (uncheck the checkbox).
The safe area represents the portion of your screen that is unobscured by bars and other operating system based content. Safe area is pre-defined by iOS across all Apple devices and is present in Android devices as well.
If you have already pinned tableView
to it's superview(not to safeArea
) with constraints but tableView
still respects safeArea
there is property contentInsetAdjustmentBehavior
in UIScrollView
(UITableView
is subclass of UIScrollView
as we know) since iOS 11.
This property is UIScrollView.ContentInsetAdjustmentBehavior
enum with 4 options.
You need to set .never
to contentInsetAdjustmentBehavior
.
What works with any view is to associate the bottom constraint of the table view to the bottom anchor of the root (or parent) view (instead of the SafeArea).
This can be done in the storyboard editor double clicking on the constraint in the right inspector and changing the first item anchor from SafeArea to Superview (or any wanted view).
You can then set the edge insets at will if needed (to avoid content remain partially hidden behind the rounded frame corners or the notch if applying the same procedure to the top anchor)
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