How to get full screen UITableView (with title) in iPhone X?

I am updating my application with Xcode 9 for compatibility with iPhone X. I am using an automatic layout and have the โ€œUse Safe Zone Planning Guideโ€ marked.

I have a title in a UITableView, and as you can see in the screenshot below, the title view strictly respects the top safe area. The header does not match my top tableview constraint (which is larger than the safe area)

enter image description here

My restrictions on viewing the table:

enter image description here

How do I do to change the title to fill the top of the screen (white area in the screenshot)?

+11
source share
3 answers

This is probably due to your limitations being poorly established.

You just need to change the upper limit of your title by double-clicking on it.

Screen where you should double click:

The screen where you should double click

And change the restriction of the Safe Zone using the Superview element.

here

+5
source

In the size inspector for your table view, set Content Insets to Never

+27
source

To do this, set the top area of โ€‹โ€‹the table relative to the superview instead of safearea.

In viewdidload, write this

if #available(iOS 11.0, *) { self.tableView.insetsContentViewsToSafeArea = false; self.tableView.contentInsetAdjustmentBehavior = .never; } 
0
source

Source: https://habr.com/ru/post/1272013/


All Articles