iOS 7 and later: set status bar style per view controller
Have you tried this?
Set "View controller-based status bar appearance" (
UIViewControllerBasedStatusBarAppearance
) toYES
in your Info.plist. (YES
is the default, so you can also just leave this value out of your plist.)In your viewDidLoad method, call
[self setNeedsStatusBarAppearanceUpdate]
.-
Implement
preferredStatusBarStyle
, returning the status bar style that you want for this view controller.- (UIStatusBarStyle) preferredStatusBarStyle { return UIStatusBarStyleLightContent; }
There is a catch here if your view controller is inside standalone UINavigationController and not a part of Storyboard based UINavigationController then above all methods fail. I came across this situation and then in order to set the status bar to light style i used following
[self.navigationController.navigationBar setBarStyle:UIBarStyleBlack];
This worked perfectly for me.