skip to Main Content

Cant hide status bar. Is it possible on iPhones with an eyebrow?

In ViewController:

...
override var prefersStatusBarHidden: Bool {
    return true
}
...

override func viewDidLoad() {
    super.viewDidLoad()

    print(prefersStatusBarHidden) // true
}
...

enter image description here

enter image description here

2

Answers


  1. Add View controller-based status bar appearance in .plist and set it to YES.

    Login or Signup to reply.
  2. Method 1: Go to Your info.plist file.
    Add a key called “View controller-based status bar appearance” and set its value to NO.
    Method 2: Go to your app delegate and write this line of code.

    UIApplication.shared.isStatusBarHidden = true
    

    Example:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {    
    // Override point for customization after application launch.    
     UIApplication.shared.isStatusBarHidden = true    
    return true
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search