0

This is really weird, I have page view controller with onboarding flow and I cannot set the white color in status bar.

I added "Status bar style" with "UIStatusBarStyleLightContent" value in info.plist along with appropriate line in AppDelegate

UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent

Despite making these two steps I keep getting black status bar.

Maybe this is something with Xcode 6.3? Did any of you encounter such a weird issue? If yes, how to fix that?

Thanks in advance!

theDC
  • 6,364
  • 10
  • 56
  • 98

4 Answers4

1

Just added these four lines into my Info.plist

<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>

After that I didn't even needed to set anything from code.

Dániel Nagy
  • 11,815
  • 9
  • 50
  • 58
0

Add in your ViewController :

override func preferredStatusBarStyle() -> UIStatusBarStyle {
    return UIStatusBarStyle.LightContent
}
gabuh
  • 1,166
  • 8
  • 15
  • should I create new class? Or where should I paste this code? – theDC May 05 '15 at 11:19
  • New class. it replaces the basic UINavigationController that you are using. – gabuh May 05 '15 at 11:21
  • Ok, then do sth more, import somewhere this class or just create it and the whole rest will be handled? – theDC May 05 '15 at 11:22
  • If you are using storyboards, select the navigationController in it, and assign it to your new subclass. Like when you assign a TableViewController to a custom subclass... – gabuh May 05 '15 at 11:23
  • And if you are instantiating an instance of UINavigationController, just replace it by an instance of your new subclass – gabuh May 05 '15 at 11:26
  • I'm not using nav controller so far. What if it was a single view app, this must be a way to set the status bar light – theDC May 05 '15 at 11:30
  • Sorry then, I misread your post.... then just use `preferredStatusBarStyle()` it in your ViewController – gabuh May 05 '15 at 11:34
0

You need to follow below steps.

  1. Set the View controller-based status bar appearance to NO in the .plist file.

  2. UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent

Hitendra Solanki
  • 4,871
  • 2
  • 22
  • 29
0

The perfect and working way to make StatusBar LightContent.

1) Go to info.plist and add property 'View controller-based status bar appearance' = NO

2) In your AppDelgate.swift, put this code:

application.setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)

This definitely works! Try it and let me know, if you face any issues.

Sohil R. Memon
  • 9,404
  • 1
  • 31
  • 57