有兩種方法可以隱藏狀態(tài)欄: 1、全局隱藏;2、Controller內(nèi)單獨(dú)設(shè)置
狀態(tài)欄默認(rèn).png
隱藏狀態(tài)欄.png
-
全局隱藏狀態(tài)欄
1.TARGETS->Deployment Info->Hide status bar
TARGETS.png
2.info.plist->View controller-based status bar appearance
infoPlist.png
除上述外還有一種全局隱藏狀態(tài)欄的方法:
UIApplication.sharedApplication().statusBarHidden = true
-
單獨(dú)隱藏狀態(tài)欄
在需要隱藏狀態(tài)欄的控制器重寫此方法
注意:如果在設(shè)置以下方法時(shí)info.plist->View controller-based status bar appearance為NO,則無效。刪掉或者設(shè)置為YES即可
override func prefersStatusBarHidden() -> Bool {
return true
}