In my project I've integrated the SWRevealViewController, and while I was setting it up I noticed that one of my view controllers - managed by a UINavigationController - had a black status bar even though the background color of the view controller is white. How can I change the Status Bar color back to white? (Either programmatically or in the Interface Builder)
Asked
Active
Viewed 904 times
1 Answers
4
If below the status bar is a navigation bar, the status bar style will be adjusted to match the navigation bar style (UINavigationBar.barStyle):
Specifically, if the navigation bar style is UIBarStyleDefault
, the status bar style will be UIStatusBarStyleDefault
; if the navigation bar style is UIBarStyleBlack
, the status bar style will be UIStatusBarStyleLightContent
.
So in your case as status bar is black,
If you want UIStatusBarStyleLightContent
on a UINavigationController use:
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
Also you can refer: preferredStatusBarStyle isn't called
-
I think he meant the color of the background under the status bar icons, not the color of status bar icons, example he doesn't want to change the color of battery icon from back to white maybe he want to leave it as black but change the background to blue for example, Thats what I understand from his title and question. – Hussein Dec 25 '16 at 14:34