UITableView Interfering with Status Bar

自闭症网瘾萝莉.ら 提交于 2019-12-23 07:58:14

问题


I am working on an app that has a UITableViewController that displays a list of values as so:

How can I shift the table down such that it doesn't clash with my status bar? It seems that I can't apply any constraints to this scene so I'm at a loss.


回答1:


Use the following 3 properties on your UIViewController

self.edgesForExtendedLayout=UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars=NO;
self.automaticallyAdjustsScrollViewInsets=NO;



回答2:


Set edgesForExtendedLayout for the ViewController to UIRectEdgeNone in your viewDidLoad() method. This will start the tableview from below the status bar

self.edgesForExtendedLayout = UIRectEdgeNone;



回答3:


Try this on iOS 9. In your view controller viewDidLoad() -

self.yourTableViewReference.contentInset.top = 20
self.yourTableViewReference.scrollIndicatorInsets.top = 20


来源:https://stackoverflow.com/questions/27680419/uitableview-interfering-with-status-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!