关闭我提出的电子邮件时遇到困难。iPhone:如何关闭MFMailComposeViewController?
电子邮件打开很好,但一旦打开,它将不会像mailComposeController一样关闭:邮件程序didFinishWithResult:result error:错误处理程序永远不会被调用。
据我可以告诉我,所有的位都可以做到这一点。
任何我能看到的任何想法?
这是我如何提高电子邮件:
-(IBAction)emailButtonPressed
{
的NSString *文本= @ “我的电子邮件文本”;
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.delegate = self;
[mailer setSubject:@"Note"];
[mailer setMessageBody:text isHTML:NO];
[self presentModalViewController:mailer animated:YES];
[mailer release];
}
,后来在课堂上,我有这样的代码来处理关闭(但它永远不会被调用):
-(void)mailComposeController:(MFMailComposeViewController *)mailer didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
[self becomeFirstResponder];
[mailer dismissModalViewControllerAnimated:YES];
}
我的头文件中被定义为:
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>
@interface myViewController : UIViewController <UIActionSheetDelegate, UIAlertViewDelegate, MFMailComposeViewControllerDelegate, UINavigationControllerDelegate>
谢谢
Iphaaw
谢谢 - 修复它。看起来像我的书是错的:-( – iphaaw 2010-11-06 16:44:26
也谢谢 - 我有同样的问题(不断认为这是我自我声明自我弱,原来是代表安装线!):) – 2014-07-03 15:10:23