1
votes

I have a navigation bar implemented in my iOS App and I set the tint-color to white but when running the app, the status bar does not follow the tint-color and is just transparent (see image). I'm aiming for the status bar to have the translucent style to it.

How to fix this?

enter image description here

3
Possible duplicate of Changing status bar style ios 7?Badal Shah

3 Answers

4
votes

To change the the status bar color in all the Viewcontrollers, add this to your info.plist

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

then clean and run the build.

For setting status bar color specific to ViewControllers add the following in the info.plist

<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>

And in the viewDidLoad method of ViewController call this method :

[self setNeedsStatusBarAppearanceUpdate];

And the add the following method in ViewController :

- (UIStatusBarStyle)preferredStatusBarStyle
{ 
    return UIStatusBarStyleLightContent; 
}

Cheers :]

2
votes

Have you already tried this?

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

Try this

[self setNeedsStatusBarAppearanceUpdate];//add it in view didload

- (UIStatusBarStyle) preferredStatusBarStyle { 
        return UIStatusBarStyleLightContent; 
   }

Check the Links add the view in status bar check next link