I have a custom navBar image in the navigation controllers in my app, set using UIAppearance protocol. However, when sending mail through the app (via MFMailComposeViewController
), I want the default navBar instead of the custom one. I tried the approach outlined in this question: UIAppearance Remove Custom NavBar Background for UIPopoverController but it did not work. The code I used was:
[[UINavigationBar appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
But it had no effect whatsoever. My app is iOS 6+. Is this something specific to MFMailComposeViewController
or am I missing something from this?
Edit: other approaches attempted:
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
mailer.navigationBar.barStyle = UIBarStyleBlack;
[self.navigationController presentViewController:mailer animated:YES completion:nil];
[mailer.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
Setting UIBarStyleBlack
has some effect as the "Cancel" button subsequently turns black, but the background image is still set at the old value.
UIAppearance
but set the image on those navigation controllers that need it individually. – BroadtailUIAppearance
and just set the desired style to each navbar individually. – BroadtailUIAppearance
altogether. – Broadtail