I'm trying to change the text color for navigation buttons in a MFMailComposerViewController but it doesn't work like on iOS 6. In iOS 6 it worked with UIAppearance like this:
// Navigation button
UIBarButtonItem *barButton = [UIBarButtonItem appearance];
NSDictionary *barButtonTitleTextAttributes = @{UITextAttributeTextColor: [UIColor redColor]};
NSDictionary *disabledBarButtonTitleTextAttributes = @{UITextAttributeTextColor: [UIColor grayColor]};
[barButton setTitleTextAttributes:barButtonTitleTextAttributes forState:UIControlStateNormal];
[barButton setTitleTextAttributes:disabledBarButtonTitleTextAttributes forState:UIControlStateDisabled];
[barButton setBackgroundImage:[[UIImage imageNamed:@"btn_appearance"] stretchableImageWithLeftCapWidth:6 topCapHeight:0] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
But this doesn't work on iOS 7 and looks always like this:
I also tried to set the tintColor
attribute on the navigationBar but this has no effect either:
navigationBar.tintColor = [UIColor redColor];
Is there anyway to change the navigation button text color in a MFMailComposeViewController on iOS 7?
I used this and works perfect in iOS7+
MFMailComposeViewController* mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
[mailViewController setToRecipients:@[@"[email protected]"]];
[mailViewController.navigationBar setTintColor:[UIColor orangeColor]];
[self presentViewController:mailViewController animated:YES completion:nil];
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