Reputation: 245
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?
Upvotes: 1
Views: 1178
Reputation: 1204
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
Upvotes: 2
Reputation: 1891
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 :]
Upvotes: 4
Reputation: 127
Have you already tried this?
UIApplication.sharedApplication().statusBarStyle = .LightContent
Upvotes: 2