问题
In XCode 5 if I check Status Bar: Hide during application launch in project target settings.
- In iOS7 the application works as expected, after launch the app has status bar visible
- However in iOS6 is the status bar hidden after app launch
Any suggestion how to make Status bar hidden during application launch, working on iOS6 and iOS7 ?
回答1:
For iOS6 and below, we used to write a line of code in didFinishLaunchingWithOptions:
as
[UIApplication sharedApplication].statusBarHidden = YES;
However you have to be careful in some events like if you are accessing photo library of your camera. In that screen, status bar will appear. Interestingly, after the screen containing the photo library is dismissed, the status bar appears again. So inside the view controller of the first screen after the photo library screen is dismissed, you have to write that piece of code again.
For iOS7, the procedure has changed. You have to set it in info.plist
of your application. If you are having multiple targets for the same app, for each of the info.plist
, you have to set the key of View controller-based status bar appearance
as NO
. Just to easily remember the key name, alphabetically, it is the last key in friendly key-value format.
Using XIB, you can't hide the status bar. However for visualization purpose, when you are designing the screen, you can hide it or show it.
Hope this answer helps you.
来源:https://stackoverflow.com/questions/20152738/ios6-hidden-status-bar