2010-03-08 50 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協議定製接口的外觀。