0

I am setting the appearance protocol to add a custom image for all my navigation bars. This is working as expected, but I do not want to change the appearance for the MFMailComposeViewController's navigation bar.

How can I make this navigation bar, the default navigation bar?

[[UINavigationBar appearance] setBackgroundImage:[ApplicationStyle navigationBarImage] forBarMetrics:UIBarMetricsDefault];
Vikings
  • 2,527
  • 32
  • 45

1 Answers1

1

The appearance proxy enables you to modify the appearance of the UI when it's contained in a specific class through the -appearanceWhenContainedIn method. You can set the image to nil to prevent it from being shown in the MFMailComposeViewController class as shown below. [[UINavigationBar appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

According to this question, you need to change the appearance proxy before and after you present the modal MFMailComposeViewController in order to change its appearance back to how it was.

Override UIAppearance property for MFMailComposeViewController

Community
  • 1
  • 1
max_
  • 24,076
  • 39
  • 122
  • 211
  • I tried that, and it does not work – Vikings Jul 08 '13 at 22:33
  • That's odd, I've used the above code for exactly the same purpose, and it's worked perfectly. All other questions regarding the same matter provide the same answer too. Are you sure that you're not overriding the navigationBar appearance anywhere else? – max_ Jul 08 '13 at 22:35
  • Can you confirm this works in iOS 6, and i'm not overriding the appearance anywhere else – Vikings Jul 08 '13 at 22:37
  • Thanks I did not see that article when I searched – Vikings Jul 08 '13 at 22:46