The iOS 7 Transition Guide give a good hint how to change the UIStatusBarStyle
dynamically in a UIViewController
using
- (UIStatus
We should notice that non-fullscreen modalVC CAN use modalPresentationCapturesStatusBarAppearance
to control the statusBar style.
Anyone who wanna know more about Status Bar control should not ignore the UIViewController Managing the Status Bar.
Update at 2015-11-06:
And make sure you have set UIViewControllerBasedStatusBarAppearance
described in iOS Keys
Update at 2018.04.09:
I noticed that viewController in a navController may not get call prefersStatusBarHidden
with iOS 10.0 - 10.2. Custom your navigationController to ensure that
@implementation YourCustomNavController
//for iOS 10.0 - iOS 10.2
- (BOOL)prefersStatusBarHidden {
UIViewController *childVC = [self childViewControllerForStatusBarHidden];
if (childVC) {
return [childVC prefersStatusBarHidden];
}
return [super prefersStatusBarHidden];
}
@end
And anyone who want to go deeper inside can dig into UIKit +[UIViewController _currentStatusBarStyleViewController]
using Hopper or IDA Pro. It may helps you solve these kinds of bugs.