9
votes

iOS uses standard (blue) tint color for all colored texts in MFMailComposeViewController. This is not good for me, as customer wants his company colors in app. How to change their color to orange?

I am asking specifically about colors of button icons (add image and bell image) and texts containing mail addresses. I already have navigation bar colors changed. In documentation, there is written:

The view hierarchy of this class is private and you must not modify it. You can, however, customize the appearance of an instance by using the UIAppearance protocol.

I have tried to use it, but it is not working (I might doing it a wrong way, as I do not know UIAppearance). This is what I have tried:

        [[UIButton appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];

        [[UILabel appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setTextColor:[UIColor orangeColor]];

enter image description here

2
Use tintColor like this, mailComposerViewController.view.tintColor = [UIColor whiteColor]Sandeep
Property tintColor is not available for MFMailComposeViewControllerReconquistador
Sorry I meant view, please look at the edit above.Sandeep
Color has not been changedReconquistador
Do you want to change the text color inside navigation bar or just inside the view ?Sandeep

2 Answers

1
votes

As Apple says: https://developer.apple.com/library/ios/documentation/MessageUI/Reference/MFMailComposeViewController_class/index.html

The view hierarchy of this class is private and you must not modify it. You can, however, customize the appearance of an instance by using the UIAppearance protocol.

Anyway, you can check this post: Customizing automatic MFMailComposeViewController opened from UITextView

1
votes

I got this problem too. Just use:

UIView.appearance().tintColor = .orange

This works fine but there is a flaw. The recipients text will change back to system tintColor(blue) when editing.