I need to let a specific ViewController embedded in an UINavigationController
to have light status bar text color (but other ViewController
s to behave differently). I am aware of at least 3 methods, none of which however work in my case.
How to change Status Bar text color in iOS 7, the method is primarily:
- Set the
UIViewControllerBasedStatusBarAppearance
toYES
in the plist - In viewDidLoad do a
[self setNeedsStatusBarAppearanceUpdate];
Add the following method:
- (UIStatusBarStyle)preferredStatusBarStyle{ return UIStatusBarStyleLightContent; }
Running on iOS 7.0.3, this method does not work for me, since even after I have implemented all 3 steps correctly,
preferredStatusBarStyle
is never called.- Set the
UIStatusBarStyle PreferredStatusBarStyle does not work on iOS 7, the method is primarily:
Setting your
navigationBar
’sbarStyle
toUIBarStyleBlackTranslucent
will give white status bar text (ie.UIStatusBarStyleLightContent
), andUIBarStyleDefault
will give black status bar text (ie.UIStatusBarStyleDefault
).This method works fair and square on iPhone, but not on iPad.
Setting the
UIViewControllerBasedStatusBarAppearance
toNO
in the plist, and use[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
This clearly doesn't apply in this case, since I need to only specify different status bar colors for two of the
ViewController
s.
Thanks for all help!
Currently you can only do light and dark. To change to light do.
Set the
UIViewControllerBasedStatusBarAppearance
toYES
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
toUIStatusBarStyleDefault