prefersStatusBarHidden not called
For swift 3, first, make sure that View controller-based status bar appearance
is set to YES
in your Info
plist file
And then just add this to your view controller:
override var prefersStatusBarHidden: Bool {
get {
return true
}
}
I hope this helps people in the future.
Firstly, View controller-based status bar appearance
in the .plist
file must be set to YES.
- If you want status bar to be hidden in the whole app:
For Objective-C:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[application setStatusBarHidden:YES];
return YES;
}
For Swift:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject:AnyObject]?) -> Bool {
application.statusBarHidden = true
return true
}
- If you want status bar is disappeared in Specify View Controller, in
.m
file, just implement:
For Objective-C:
- (BOOL)prefersStatusBarHidden {
return YES;
}
For Swift:
override func prefersStatusBarHidden() -> Bool {
return true
}
Figured it out. in info.plist file: view controller-status bar appearance should be set to YES