Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TableView and the home indicator on iPhone X

I am using both UITableViewController and UITableView in one project.

An UITableView in an UITableViewController overlays the home indicator on iPhone X. But an UITableView in an UIViewController doesn't overlay the home indicator on iPhone X. Should I fit one? And which one is correct when I consider about safe area?

e.x.

UITableViewController

UITableView on UIViewController

like image 882
Tamcha Avatar asked Oct 25 '17 04:10

Tamcha


People also ask

What is IOS home indicator?

The home indicator (If I'm getting the name correct) is that little bar at the bottom of an iPhone screen that you swipe up in order to return to the home screen. This bar replaced the home button / finger print scanner of older models.

How do I hide the Home icon on my iPhone X?

You simply need to tap Start (or Resume, if you've triple-clicked a second time) to enter Guided Access mode, in which the Home bar is disabled.


1 Answers

You can continue to use a UITableView on a standard UIViewController. Just set auto layout so the bottom of the tableview is flush with the bottom of the superview (and not the margin). Then set the insetsContentViewsToSafeArea property of the tableview to true

Swift:

if #available(iOS 11.0, *) {
    tableView.insetsContentViewsToSafeArea = true;
}

Objective-C:

if (@available(iOS 11.0, *)) {
    [tableView setInsetsContentViewsToSafeArea:YES];
}
like image 184
Dave Wood Avatar answered Sep 28 '22 09:09

Dave Wood