我正在尝试截取屏幕截图并使用邮件编辑器通过电子邮件发送。一切都很好,除了邮件作曲家不会解雇。这篇文章似乎有同样的问题,但提供的解决方案对我不起作用。无法关闭 iPhone 中的电子邮件编辑器视图?
- (IBAction)Email:(id)sender {
UIGraphicsBeginImageContext(self.view.frame.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData * imageData = UIImageJPEGRepresentation(image, 1.0);
if ( [MFMailComposeViewController canSendMail] ) {
MFMailComposeViewController * mailComposer = [[[MFMailComposeViewController alloc] init] autorelease];
mailComposer.delegate = self;
[mailComposer setSubject:@"Risk Assessment"];
[mailComposer addAttachmentData:imageData mimeType:@"image/jpeg" fileName:@"attachment.jpg"];
[self presentModalViewController:mailComposer animated:YES];
}
}
上面的代码效果很好。我如何称呼这个底部。似乎编译器只是跳过它。
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{
if (error){
NSString *errorTitle = @"Mail Error";
NSString *errorDescription = [error localizedDescription];
UIAlertView *errorView = [[UIAlertView alloc]initWithTitle:errorTitle message:errorDescription delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[errorView show];
[errorView release];
}
[controller dismissModalViewControllerAnimated:YES];
}
提前致谢。