Swift:Tableview 在导航栏下方但在状态栏上方滚动?
问题描述:
我使用以下技巧隐藏了导航栏的阴影:
I hid the navigation bar's shadow using the following trick:
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
我还有以下套装:
self.extendedLayoutIncludesOpaqueBars = true
self.automaticallyAdjustsScrollViewInsets = true
self.tabBarController?.tabBar.isHidden = true
我的页面上的一切看起来都很好,除了当我向上滚动 tableView
时,它按预期位于导航栏下方,但位于状态栏上方:
Everything looks fine on my page, except that when I scroll up my tableView
it goes under the navigation bar as expected, but above the status bar:
如何确保 tableView
在导航栏和状态栏下方滚动?
How do I make sure that the tableView
scrolls under both the navigation bar and status bar?
答
这会将 UITableView 置于状态栏下方.
This will place the UITableView below the status bar.
self.edgesForExtendedLayout=UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars=NO;
self.automaticallyAdjustsScrollViewInsets=NO;