I need to let a specific ViewController embedded in an UINavigationController
to have light status bar text color (but other ViewController
s to beh
Currently you can only do light and dark. To change to light do.
Set the UIViewControllerBasedStatusBarAppearance
to YES
in the .plist
file.
In the viewDidLoad
method do [self setNeedsStatusBarAppearanceUpdate];
Add the this method:
-(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}
To change it back to dark change the UIStatusBarStyleLightContent
to UIStatusBarStyleDefault
For people having this problem with a UINavigationController
I can recommend creating a custom UINavigationController
and implementing the preferredStatusBarStyle
on it like this:
- (UIStatusBarStyle)preferredStatusBarStyle
{
return [self.topViewController preferredStatusBarStyle];
}
That way the statusbar style will be that of the top view controller. Now you can implement the view controller's preferredStatusBarStyle
anyway you like.