Status Bar Style Remains Unchanged

If you are wondering why your status bar style remains unchange when you push or present modally your view controller, here’s a checklist that might help you debug the issue:

Providing status bar style preference

Ensures that you had overridden preferredStatusBarStyle method in the view controller to be pushed/presented.

Starting from iOS 7, modifying the status bar style requires you to override preferredStatusBarStyle and return the style that you wanted. Here’s an example implementation that returns the light content status bar style:

@interface CustomViewController : UIViewController
@end

@implementation CustomViewController

- (UIStatusBarStyle)preferredStatusBarStyle {
	return UIStatusBarStyleLightContent;
}

@end

Transferring control of status bar appearance

When you present a view controller by calling the presentViewController:animated:completion: method, status bar appearance control is transferred from the presenting to the presented view controller only if the presented controller’s modalPresentationStyle value is UIModalPresentationFullScreen. By setting modalPresentationCapturesStatusBarAppearance property to YES, you specify the presented view controller controls status bar appearance, even though presented non-fullscreen.

If you are doing custom transition, you might have set your view controller's modalPresentationStyle to UIModalPresentationCustom. As described above, the control of status bar appearance is not transferred in this case. You will have to set the modalPresentationCapturesStatusBarAppearance value to YES to receive control of status bar appearance. Here’s an example implementation:

CustomViewController *customViewController = [[CustomViewController alloc] initWithNibName:nil bundle:nil];
customViewController.modalPresentationStyle = UIModalPresentationCustom;
customViewController.modalPresentationCapturesStatusBarAppearance = YES;
[self presentViewController:customViewController animated:YES completion:nil];