Xcode 8.2: Swift3- how to hide the status bar?

all attempts to hide the status bar using Xcode 8.2 with quick 3. but I can not hide it.

enter image description here

enter image description here

as well as for <

enter image description here

+6
source share
3 answers

You can approach this in two ways.

Option 1 Try this in the didFinishLaunchingWithOptions Method

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { UIApplication.shared.isStatusBarHidden = true return true } 

Option 2 override prefersStatusBarHidden function in UIViewController

 override var prefersStatusBarHidden : Bool { return true } 

Note: you call override func prefersStatusBarHidden , this must be override var prefersStatusBarHidden

+12
source

In swift 3 use this,

 override var prefersStatusBarHidden: Bool { return true } 

Link Link

+1
source

override prefersStatusBarHidden in your view controller

 override var prefersStatusBarHidden : Bool { return true } 

true if the status bar should be hidden or false if it should be displayed.

Refer apple document link

+1
source

Source: https://habr.com/ru/post/1013375/


All Articles