2013-07-29 16 views
5

目前我使用[MFMailComposeViewController canSendMail]來檢查設備中是否存在某個帳戶。如果不是,我希望顯示一些警報。顯示系統警報「無郵件帳戶」

我看到一個類似的應用程序,它給出了本地化語言中的「無郵件帳戶」提示。

我想要同樣的警報也應該本地化。

這是一些系統警報還是我將不得不創建一個與所有本地化字符串的自定義?

這裏是我使用

if (![MFMailComposeViewController canSendMail]) 
    return nil; 
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init]; 
if(mailViewController) 
{ 
     //Setting Email Stuff 
} 

回答

3

這是一個系統消息的確切的實現,所以你不必本地化它,它會以正確的語言顯示如果您的項目包含語言

  Class mailClass = (NSClassFromString(@"MFMailComposeViewController")); 
      if (mailClass != nil) 
      { 
       MFMailComposeViewController *vc = [[[MFMailComposeViewController alloc] init] autorelease]; 
       if (vc!=nil) { 
        [vc setSubject:@"Mail subject"]; 

        NSMutableString * message = @"mail message"; 

        [vc setMessageBody:message isHTML:YES]; 


        vc.mailComposeDelegate = self; 

        [self presentModalViewController:vc animated:YES]; 
       } 

      } 
      else 
      { 
       //Device doesn't include mail class, so it can't send mails 
      } 

不檢查canSendMail和設備會顯示不佔警報當您嘗試發送郵件

+0

如何調用這個特殊的警報..? –

+0

@GaneshSomani你不知道。它在需要時顯示。 –

+0

看到我的編輯樣本。只是不檢查canSendMail – jcesarmobile