如何更改 MFMailComposeViewController 文本和按钮图像的颜色? [英] How to change color of MFMailComposeViewController texts and button images?

查看:70
本文介绍了如何更改 MFMailComposeViewController 文本和按钮图像的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 对 MFMailComposeViewController 中的所有彩色文本使用标准(蓝色)色调.这对我不利,因为客户希望在应用程序中使用他的公司颜色.如何将它们的颜色更改为橙​​色?

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:

这个类的视图层次是私有的,你不能修改它.但是,您可以使用 UIAppearance 协议自定义实例的外观.

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.

我曾尝试使用它,但它不起作用(我可能以错误的方式使用它,因为我不知道 UIAppearance).这是我尝试过的:

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]];

推荐答案

正如 Apple 所说:https://developer.apple.com/library/ios/documentation/MessageUI/Reference/MFMailComposeViewController_class/index.html

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

该类的视图层次结构是私有的,不得修改它.但是,您可以通过使用自定义实例的外观UIAppearance 协议.

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.

无论如何,您可以查看此帖子:自定义从 UITextView 打开的自动 MFMailComposeViewController

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

这篇关于如何更改 MFMailComposeViewController 文本和按钮图像的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆