How to hide status bar of a single view controller in iOS 9?

后端 未结 15 1274
挽巷
挽巷 2020-12-13 06:15

In a ViewController, which I presented modally, I did this:

override func prefersStatusBarHidden() -> Bool {
    return true
}

This used

15条回答
  •  无人及你
    2020-12-13 06:34

    In iOS 9, Xcode 7, Swift 2.0, it's back to how it was previously.

    override func prefersStatusBarHidden() -> Bool {
            return true
    }
    

    In fact Xcode will tell you that

    UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: .None) 
    

    has been deprecated and that you should use the prefersStatusBarHidden method.

提交回复
热议问题