I have an issue in iOS7 where a normal UINavigationController pushed view controller has the correct status bar text color for the UINavigationController navbar color (which is
set YourModalViewControler.modalPresentationCapturesStatusBarAppearance to YES and keep "View controller-based status bar appearance" to YES.
- (void)viewDidLoad {
[super viewDidLoad];
self.modalPresentationCapturesStatusBarAppearance = YES;
....
}
then overwrite preferredStatusBarStyle
- (UIStatusBarStyle)preferredStatusBarStyle {
return TheStyleYouWant;
}
My solution:
newViewController.modalPresentationStyle = .fullScreen
By default, UINavigationController decides the status bar style and overrides all sub view controllers styles. However, when a modal view controller is fullscreen, its method preferredStatusBarStyle
is called.
Set UIViewControllerBasedStatusBarAppearance
to NO
in your info.plist