I am using the UIActivityViewController to share items in iOS7. When I tap on the Mail option, it pops up the mail composer, but the Cancel and Send buttons on the navigation bar and the navigation bar itself are blue, making it very difficult to read, so I want to change their color. It's working in iOS6 but not in iOS7.
I tried
[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor], UITextAttributeTextColor, [UIColor clearColor], UITextAttributeTextShadowColor, nil] forState:UIControlStateNormal];
which works in iOS6, and I tried
[[UIBarButtonItem appearance] setTintColor:[UIColor redColor]]; [[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];
which causes the color to flash red the first time the app is run before immediately switching back to the blue color.
Managed to change the text color of the Send and Cancel buttons, which are on the UINavigationBar
in the MFMailComposerViewController
(both Send and Cancel) and MFMessageComposeViewController
(only Cancel), when presented from UIActivityViewController
.
Using an UIActivityViewController, tap on Message
or Mail
:
You'll notice that the default text color of the Send and Cancel buttons is blue:
In order to change that, in the AppDelegate.m
class, in the didFinishLaunchingWithOptions
method, insert the following line:
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor whiteColor]];
This results in:
You can also use other colors, for example:
[UIColor purpleColor];
[UIColor greenColor];
How did I test this? I noticed this solution works for the following:
It didn't work when testing with:
Therefore it should be safe to use, as I believe the behavior on the actual device matters more than the behavior in the iOS simulator. If anyone knows why it doesn't work in the iOS 7.0 simulator, I would like to know. :)
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