1

I'm having an issue with the navigation Bar in MFMailComposeViewController.

I have an app where we set the "Status bar style" to "UIStatusBarStyleLightContent" in the plist file. It works perfectly in all views except when I call up MFMailComposeViewController. It goes back to black. The rest is ok. We have a custom image that does carry forward, and I can set the tint color with no problems. Any one know how to fix this? How to reset the "Status bar style" to "UIStatusBarStyleLightContent" in mail?

in AppDelegate

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"headerLogo.png"] forBarMetrics:UIBarMetricsDefault];

calling mail

    MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
    mailController.mailComposeDelegate = self;

    [[mailController navigationBar] setTintColor:[UIColor whiteColor]];
    [[mailController navigationBar] setBarTintColor:[UIColor whiteColor]];

    [self presentViewController:mailController animated:YES completion:nil];
LittlePeculiar
  • 383
  • 5
  • 16

2 Answers2

1

I believe setting the barStyle in MFMailViewController is something that is not accessible unless because of private API in Apple's code. The reason why you're able to set the UINavigationBar to a certain picture in the app delegate is because in the app delegate, you are calling to the appearance of the UINavigationBar class instead of the tint color of the MFMailViewController's navigation bar.

Hope this helps

user2277872
  • 2,963
  • 1
  • 21
  • 22
0

In the info.plist add new row:

UIViewControllerBasedStatusBarAppearance

Set it to:

NO

MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];

[self presentViewController: mail animated: YES completion: ^ {
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

}];
daniel kilinskas
  • 3,538
  • 3
  • 16
  • 10