Reputation: 10206
I've set the background color of the main UIView in my view controller to a bluish color.
I've also tried all combinations of the following:
Adding this to the app delegate:
UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)
Setting View controller status based application to NO and YES
Setting 'Status Bar Style' to Light in the project overview.
I'm seeing black status bar text when I want to see white text.
I'd like to set the style at the application level, not the VC level.
My info.plist:
Upvotes: 9
Views: 4288
Reputation: 1261
for all IOS 9+
In your plist file change add/change your table with these 2 lines.
1) View controller-based status bar appearance
to NO
2) Status bar style
to UIStatusBarStyleLightContent
If you want to change style in running app for any reason use this
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
this saved my life numerous times! :-)
Upvotes: 15
Reputation: 429
Swift 4
In Info.plist add this property
View controller-based status bar appearance to NO
and after that in AppDelegate inside the didFinishLaunchingWithOptions add these code
UIApplication.shared.isStatusBarHidden = false
UIApplication.shared.statusBarStyle = .lightContent
Upvotes: 2
Reputation: 113
you can use this code
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
might be Solve this issue.
Upvotes: 1
Reputation: 534885
Status bar style is determined (by default) at the level of the view controller, not the application. Implement preferredStatusBarStyle
in your view controller.
class ViewController : UIViewController {
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return .LightContent
}
}
You can determine status bar style at the application level, but to do so, you must throw a switch in your Info.plist. See the docs:
To opt out of the view controller-based status bar appearance behavior, you must add the
UIViewControllerBasedStatusBarAppearance
key with a value of NO to your app’s Info.plist file, but doing so is not recommended [my italics, and I don't even know whether this is even supported any longer].
Upvotes: 10