IOS 8 status light not working
I set the background color of the main UIView in my view controller to a bluish color.
I have also tried all combinations of the following:
-
Adding this to the app delegate:
UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)
-
Setting View status based on controller status for NO and YES
-
Setting the "Status Bar" for lighting in the project overview.
I see black line text when I want to see white text.
I would like to set the styling at the application level, not the VC level.
My info.plist:
source to share
The status bar style is defined (by default) at the view controller level, not the application level. Inject preferredStatusBarStyle
into your controller.
class ViewController : UIViewController {
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return .LightContent
}
}
You can define the style of the status bar at the application level, but for that you have to throw a switch in your Info.plist. See docs :
To opt out of the controller-based control panel appearance behavior, you must add a
UIViewControllerBasedStatusBarAppearance
NO key to your application's Info.plist file, but this is not recommended [my italics and I don't even know if this is even more supported].
source to share