2010-03-08 67 views
1

从这段代码将显示在原来的颜色我怎么能改变它到另一种颜色? 也许它需要重写?如何自定义MFMailComposeViewController的导航栏颜色?

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

回答

2

我还没有做到这一点,所以采取适当的谨慎这个答案。

MFMailComposeViewController继承自UINavigationController。这意味着它会有一个navigationBar属性。一旦你有了导航条,你可以修改它的tintColor属性。

+0

我明白了,谢谢您Giao – RAGOpoR 2010-03-08 09:20:44

+0

您在使用这种方法时一定要小心。提交给App Store时,苹果公司对拒绝按钮感到满意。如果您修改了标准iPhone界面(即邮件compoase界面),Apple可能会拒绝您的应用程序。提供的用户界面不打算修改... – Jasarien 2010-03-08 10:31:43

2

实际上,iPhone SDK禁止你修改外观MFMailComposeViewController。从文档(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. 

对不起......

+0

界面本身是不可定制的,这意味着导航栏的颜色变化? 即时通讯不知道改变颜色会冲突修改邮件组成界面。 – RAGOpoR 2010-03-11 04:06:48

+0

这可能是事实,但实际上我与苹果商店人士打交道的经验是,你不想给他们一个拒绝你应用的借口。您可能能够重新导航导航栏,但如果它最终导致您的应用程序被拒绝,我不愿意投入大量时间。 – 2010-03-11 19:11:08

0

随着iOS的更新版本中Apple Docs你应该使用UIAppearance协议

重要

不得修改该视图由该视图 控制器呈现。但是,您可以使用UIAppearance协议定制接口的外观。