2
votes

I'm trying to modify the tintColor in the UINavigationBar for the MFMailComposeViewController, but this doesn't seem to be working.

   [[UINavigationBar appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setTintColor:[UIColor whiteColor]];
   [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], [MFMailComposeViewController class], nil] setTintColor:[UIColor blackColor]];

Before anyone quotes Apple saying that "The mail composition interface itself is not customizable and must not be modified by your application", I've previously submitted an app that is live in the App Store where the UINavigationBar had been modified in a similar manner, with no issues during the review process.

It works when I set the appearance for these classes across the entire app like this:

   [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
   [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor blackColor];

The issue is that I don't want these appearance settings to apply to all UINavigationBar/UIBarButtonItem instances.

Is my understanding of how to use appearanceWhenContainedIn: incorrect? Or is it something else?

Thanks for the help as always :)

1

1 Answers

5
votes

This appears to be a bug in iOS 6.x, my Open Radar - http://openradar.me/radar?id=2984402

Apple has responded to me and it's a duplicate of a previously known bug (#12328070), so it should be fixed soon.

This code will work as expected in iOS 5.

In order to work around this, I suggest you manually apply what you want when you create the MFMailComposeViewController:

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

[mailComposerController.navigationBar setTintColor:[UIColor redColor]];

I'll update my answer if I find anything else on the subject.