我正在嘗試截圖並使用郵件編輯器通過電子郵件發送郵件。一切都很好,除了郵件作曲家不會放棄。這篇文章似乎有同樣的問題,但提供的解決方案並不適合我。 Can't dismiss the email composer view in iPhone?iOS郵件編輯器不會消除
- (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];
}
在此先感謝。
感謝您的快速響應。這工作。 – talbright 2012-07-11 14:33:08
好的。從未見過。 – 2012-07-11 14:49:04
數小時試圖找到我的問題,這固定它! – Mark 2013-11-22 16:07:32