swifttableviewuiedgeinsetssafeareaview

Make UITableView ignore Safe Area


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?


Solution

  • 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.