如何自定义 MFMailComposeViewController 的导航栏颜色?

发布于 2024-08-24 15:20:25 字数 606 浏览 14 评论 0原文

从这段代码将以原始颜色显示我如何将其更改为另一种颜色? 也许需要覆盖它?

MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
    mail.mailComposeDelegate = self;
    if ([MFMailComposeViewController canSendMail]) {
        [mail setToRecipients:[NSArray arrayWithObjects:@"[email protected]",nil]];
        [mail setSubject:@"support"];
        [mail setMessageBody:@"enter your message here" isHTML:NO];
        [self presentModalViewController:mail animated:YES];
    }

from this code will show in original color how can i change it to another color?
maybe it need to be override?

MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
    mail.mailComposeDelegate = self;
    if ([MFMailComposeViewController canSendMail]) {
        [mail setToRecipients:[NSArray arrayWithObjects:@"[email protected]",nil]];
        [mail setSubject:@"support"];
        [mail setMessageBody:@"enter your message here" isHTML:NO];
        [self presentModalViewController:mail animated:YES];
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

疏忽 2024-08-31 15:20:26

我还没有这样做,所以请谨慎对待这个答案。

MFMailComposeViewController 继承自 UINavigationController。这意味着它将有一个 navigationBar 属性。获得导航栏后,您可以修改其 tintColor 属性。

I haven't done this so take this answer with appropriate caution.

MFMailComposeViewController inherits from UINavigationController. That means it'll have a navigationBar property. Once you have the navigationBar you can modify its tintColor property.

她如夕阳 2024-08-31 15:20:26

实际上,iPhone SDK 禁止您修改 MFMailComposeViewController 的外观。从文档(此处):

Important: The mail composition interface itself is not customizable
and must not be modified by your application. In addition, after
presenting the interface, your application is not allowed to make 
further changes to the email content. The user may still edit the
content using the interface, but programmatic changes are ignored. 
Thus, you must set the values of content fields before presenting 
the interface.

抱歉...

Actually, the iPhone SDK prohibits you from modifying the appearance MFMailComposeViewController. From the docs (here):

Important: The mail composition interface itself is not customizable
and must not be modified by your application. In addition, after
presenting the interface, your application is not allowed to make 
further changes to the email content. The user may still edit the
content using the interface, but programmatic changes are ignored. 
Thus, you must set the values of content fields before presenting 
the interface.

Sorry...

幼儿园老大 2024-08-31 15:20:26

Apple Docs 中的更高版本 iOS 起你应该使用 UIAppearance 协议

重要

您不得修改此视图呈现的视图层次结构
控制器。但是,您可以自定义外观
使用 UIAppearance 协议的界面。

As of later versions of iOS in Apple Docs you should use UIAppearance protocol

Important

You must not modify the view hierarchy presented by this view
controller. You can, however, customize the appearance of the
interface using the UIAppearance protocol.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文