I'm trying to change the background color of the MFMailComposeViewController
in iOS7 but I cannot make it work.
I'm using the following snipped:
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; if([picker.navigationBar respondsToSelector:@selector(barTintColor)]) { // iOS7 picker.navigationBar.barTintColor = READER_NAVIGATION_BAR_BACKGROUND_COLOR; // Set back button arrow color [picker.navigationBar setTintColor:READER_NAVIGATION_BAR_BACK_BUTTON_ARROW_COLOR]; // Set Navigation Bar Title Color [picker.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:READER_NAVIGATION_BAR_TITLE_NORMAL_FONT_COLOR forKey:UITextAttributeTextColor]]; // Set back button color [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:READER_NAVIGATION_BAR_BUTTONS_FONT_COLOR, UITextAttributeTextColor,nil] forState:UIControlStateNormal]; }
Does anybody knows how to change the bakcground color of the MFMailComposeViewController
in iOS7?
The trick here is to call 'appearance methods' such as
[UINavigationBar appearance].barTintColor = [UIColor whiteColor]; [UINavigationBar appearance].tintColor = [UIColor redColor];
BEFORE calling to
[[MFMailComposeViewController alloc] init];
This way the color scheme will be applied to the mail composer. It may be returned back to defaults in mailComposeController:didFinishWithResult:
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