更改 MFMailComposeViewController 的工具栏颜色
我在 iPhone 应用程序中使用有色导航栏和有色全局 UIToolbar。 在我的信息视图中,我有一个打开 MFMailComposeViewController 的按钮,并且该视图顶部的工具栏(带有“取消”和“发送”按钮)仍然是蓝色的。我这样调用 MFMailComposeViewController:
-(void)displayMailSheet
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"..."];
NSArray *toRecipients = [NSArray arrayWithObject:@"..."];
[picker setToRecipients:toRecipients];
[self presentModalViewController:picker animated:YES];
[picker release];
}
是否可以更改该视图工具栏的颜色?如果可能的话,我该怎么做?
I'm using a tinted navigation bar and a tinted global UIToolbar in my iPhone app.
In my info view, I have a button which opens a MFMailComposeViewController, and the toolbar at the top of that view (with the "cancel" and "send" button) is still blue. I'm calling the MFMailComposeViewController like this:
-(void)displayMailSheet
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"..."];
NSArray *toRecipients = [NSArray arrayWithObject:@"..."];
[picker setToRecipients:toRecipients];
[self presentModalViewController:picker animated:YES];
[picker release];
}
Is it possible to change the color of that view's toolbar? If it is possible, how can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
给你:
适用于 iOS 8.0
Here you go:
for iOS 8.0
关于 iOS7 下此功能的一个小问题 - 色调颜色属性不再影响整个栏的颜色,而是仅更改“发送”和“取消”按钮的颜色(在 iOS7 风格中,这些按钮只是有色标签)。
如果您将标题栏颜色更改为白色或透明之类的颜色,则值得注意,因为在 iOS7 下,发送和取消按钮将不再可见。
A minor point about this functionality under iOS7 - the tint color property no longer affects the colour of the bar as a whole, instead it simply changes the colour of the 'Send' and 'Cancel' buttons (which, in iOS7 style, are simply tinted labels).
This is worth noting if you have changed the title bar colour to something like white or clear, as under iOS7 the send and cancel buttons will no longer be visible.
您可以从 appdelegate 全局执行此操作
you can do it globally from appdelegate
只是想强调一下,上面关于苹果拒绝你的申请的帖子是一篇旧帖子。这是当前 MFMailComposeViewController 文档的引用...
Just want to emphasize that the above post about Apple rejecting your application is an old post. Here is a quote from the current MFMailComposeViewController documentation...
试试这个:
Try this:
来自官方 MFMailComposeViewController 类参考:
重要提示:邮件撰写界面本身不可自定义,并且您的应用程序不得对其进行修改。 [...]
我认为在不进行任何更改的情况下呈现默认的邮件撰写界面将是一个更好的选择。否则 Apple 可能会拒绝您的申请。
在这里问问有没有人有过这样的经历。
From the official MFMailComposeViewController Class reference:
Important: The mail composition interface itself is not customizable and must not be modified by your application. [...]
I think it would be a better choice presenting the default mail composition interface without any changes. Otherwise Apple may reject your application.
Let's ask here if someone had an experience in this way.