In my iOS video app status bar is hidden in some view controllers. I have done this using following code.
[[UIApplication sharedApplication] setStatusBarHidden:YES];
It works for iOS 5 and iOS 6 , but not in iOS 7.
I tried with this in particular view controller,
Eg:
-(BOOL)prefersStatusBarHidden { return YES; }
It works well, but I cant show status bar again in the parent view controller.
To hide status bar in iOS7 you need 2 lines of code
in application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions write
in info.plist add this
Update for Swift 3:
Update Info.plist with the following info:
View controller-based status bar appearance: NO
Then, in a ViewController or elsewhere:
UIApplication.shared.isStatusBarHidden = true
To hide your status bar in iOS7:
Open Your plist-file, then add a add a row called "View controller-based status bar appearance" and set its value to
NO
.In iOS10 all I needed to do is override the
prefersStatusBarHidden
var in myRootViewController
(Swift):From
UIKit
>UIApplication.h
:So should set
View controller-based status bar appearance
to NOSteps for hide status bar in iOS
1. open AppDelegate.m file, add application.statusBarHidden in didFinishLaunchingWithOptions method
View controller-based status bar appearance
setNO