iOS 8 light status bar not working

you can use this code

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

might be Solve this issue.


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

enter image description here

If you want to change style in running app for any reason use this

 [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

this saved my life numerous times! :-)


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].


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

Tags:

Ios

Swift