TableView和iPhone X上的主页指示器 [英] TableView and the home indicator on iPhone X
问题描述
我在一个项目中同时使用 UITableViewController
和 UITableView
。
I am using both UITableViewController
and UITableView
in one project.
UITableView
中的 UITableViewController
覆盖iPhone X上的主页指示符。
但是 UITableView
在 UIViewController
中没有覆盖iPhone X上的家庭指示器。
我应该适合吗?
当我考虑安全区域时哪一个是正确的?
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?
ex
推荐答案
你可以继续使用<标准 UIViewController
上的code> UITableView 。只需设置自动布局,以便tableview的底部与superview的底部齐平(而不是边距)。然后将tableview的 insetsContentViewsToSafeArea
属性设置为 true
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];
}
这篇关于TableView和iPhone X上的主页指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!