My current application runs on iOS 5 and 6.
The navigation bar is having an orange color and the status bar is having a black background color with white text color. However, when I run the same application on iOS 7, I observe the status bar looks transparent with the same orange background color as the navigation bar and the status bar text color is black.
Due to this I'm not able to differentiate between the status bar and the navigation bar.
How do I make the status bar to look the same as it was in iOS 5 and 6, that is with black background color and white text color? How can I do this programmatically?
Goto your app
info.plist
1) Set
View controller-based status bar appearance
toNO
2) Set
Status bar style
toUIStatusBarStyleLightContent
Then Goto your app delegate and paste the following code where you set your Windows's RootViewController.
Hope it helps.
1) set the UIViewControllerBasedStatusBarAppearance to YES in the plist
2) in viewDidLoad do a
[self setNeedsStatusBarAppearanceUpdate];
3) add the following method:
UPDATE:
also check developers-guide-to-the-ios-7-status-bar
In iOS 7 the status bar doesn't have a background, therefore if you put a black 20px-high view behind it you will achieve the same result as iOS 6.
Also you may want to read the iOS 7 UI Transition Guide for further information on the subject.
You can set background color for status bar during application launch or during viewDidLoad of your view controller.
Here is result:
Here is Apple Guidelines/Instruction about status bar change. Only Dark & light (while & black) are allowed in status bar.
Here is - How to change status bar style:
If you want to set status bar style, application level then set
UIViewControllerBasedStatusBarAppearance
toNO
in your `.plist' file.if you wan to set status bar style, at view controller level then follow these steps:
UIViewControllerBasedStatusBarAppearance
toYES
in the.plist
file, if you need to set status bar style at UIViewController level only.In the viewDidLoad add function -
setNeedsStatusBarAppearanceUpdate
override preferredStatusBarStyle in your view controller.
-
iTroid23 solution worked for me. I missed the Swift solution. So maybe this is helpful:
1) In my plist I had to add this:
2) I didn't need to call "setNeedsStatusBarAppearanceUpdate".
3) In swift I had to add this to my UIViewController:
Swift 4:-
// Change status bar background color