In an app I use white as the main tint color. If the user opens the UIActivityViewController
, I set the tint color for the controller to the standard iOS blue. This works great for the activity view itself but when one wants to send a mail, the tint color is not blue but white again.
It would be great to have a way to set the tint color of the presented views. Is there one?
Opening a MFMailComposeViewController
and setting the tint color to blue also has an effect on the displayed UIActionSheet
, not so if the MFMailComposeViewController
is opened from within an UIActivityViewController
.
See screenshots for clarification: http://i.imgur.com/OggykJF.png
Edit: This is what I do for adding the tint color to the UIActivityViewController
:
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:activities];
activityController.view.tintColor = [UIColor blueColor];
[self presentViewController:activityController animated:YES completion:nil];`
The best what you can do is to set window's tint color to system blue or any tint color you wish on UIActivityViewController just before you present it and then change window's tint color back to original just before you dismiss it. That will work. This is how I do it:
UIApplication.shared.keyWindow?.tintColor = Styles.color.systemBlue
and then
UIApplication.shared.keyWindow?.tintColor = Styles.color.tint
I had the same issue with the Cancel and Send buttons of the mail share controller being blue no matter what I tried. I found that tweaking the navbar appearance wasn't doing the trick. So I used this...
[[UIBarButtonItem appearance] setTintColor:tintColor];
I do this in an "Appearance" class I have that is called on load and sets all of the global appearances. For the navigation bar color, if you need to change that on the fly before presenting your share controller (UIActivityViewController), you can do it in the completion block when you first present your controller. For example:
[self presentViewController:[self _shareController] animated:YES completion:^{
[[UINavigationBar appearance] setBarTintColor:[UIColor yourNavBarColor]];
}];
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