Reputation: 317
all trying to hide status bar with Xcode 8.2 with swift 3. but I can't hide it.
and also for,
Upvotes: 6
Views: 7600
Reputation: 5523
You can Approach this in two ways
Option 1.Try this in
didFinishLaunchingWithOptions
Method
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
UIApplication.shared.isStatusBarHidden = true
return true
}
Option 2. override
prefersStatusBarHidden
function in yourUIViewController
override var prefersStatusBarHidden : Bool {
return true
}
Note: you call override func prefersStatusBarHidden
it should be override var prefersStatusBarHidden
Upvotes: 14
Reputation: 12023
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 shown.
Refer apple doc link
Upvotes: 1
Reputation: 3361
In swift 3 use this,
override var prefersStatusBarHidden: Bool {
return true
}
Upvotes: 1