I've a simple controller that shows another controller with a custom transition. I use a solid navigation bar:
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationBar.barTintColor = [UIColor purpleColor];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
This is the second controller:
When I open a MFMailComposeViewController
in the child controller, the status bar is white on white (this appens also with UIActivityViewController
):
It turns out that this is related to setting modalPresentationStyle
to UIModalPresentationCustom
:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
UIViewController *controller = (UIViewController*)segue.destinationViewController;
// this line cause the bug
//controller.modalPresentationStyle = UIModalPresentationCustom;
controller.transitioningDelegate = self;
}
The status bar color is correct if controller.modalPresentationStyle
is left unchanged. Moreover, this property seems not to interfere with the custom transition.
I'm missing something here? Why modalPresentationStyle
impacts on the status bar type in system controllers? Could this be a bug?
Full code is here https://github.com/mbigatti/StatusBarTest
Maybe you could try adding:
controller.modalPresentationCapturesStatusBarAppearance = YES
after setting the modalPresentationStyle
. According to the UIViewController class reference:
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 this property to YES, you specify the presented view controller controls status bar appearance, even though presented non–fullscreen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With