2010-08-16 32 views
4

我有下面的代碼從應用程序內呈現與電子郵件的用戶:MFMailComposeViewController:在取消出口

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; 
picker.mailComposeDelegate = self; 
[picker setSubject:@"Subject"]; 
NSString* link = [NSString stringWithFormat:@"<a href='%@'>Report</a>",link]; 
[picker setMessageBody:link isHTML:YES]; 
picker.navigationBar.barStyle = UIBarStyleDefault; 
[self presentModalViewController:picker animated:YES]; 
[picker release]; 

和allso:

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error{ 
    [self dismissModalViewControllerAnimated:YES]; 
} 

一切工作得很好,希望我會像取消跳過刪除草稿/保存草稿/取消階段並基本選擇刪除草稿(不向用戶顯示) 可以這樣做嗎? 謝謝

回答

1
- (void)mailComposeController:(MFMailComposeViewController *) controller didFinishWithResult:(MFMailComposeResult) result error:(NSError *)error 
    { 
     switch (result) { 
      case MFMailComposeResultCancelled: 
       break; 

      case MFMailComposeResultSaved: 
       break; 

      case MFMailComposeResultSent: 
       break; 

      case MFMailComposeResultFailed: 
       break; 

      default: 
       break; 
     } 

     //Dismiss the mailViewController. 
     [self dismissModalViewControllerAnimated:YES]; 
    } 

這是你在找什麼?然後您可以單獨處理每個錯誤或完成!

相關問題