0
我已閱讀其他線程並嘗試多個變量。在應用程序電子郵件將發送電子郵件,但不會解僱在Xcode
我有一個應用程序,附加到應用程序內的電子郵件的屏幕截圖。
當我按下發送或取消按鈕時,電子郵件不會消失。
不知道我是否有此操作的委託。
代碼:
.h
- (IBAction)openMail: (id)sender;
.m
//Open Mail
- (IBAction)openMail: (id)sender {
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
NSData * imageData = UIImageJPEGRepresentation(viewImage,2.0);
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController * mailComposer = [[MFMailComposeViewController alloc]
init];
mailComposer.delegate = self;
[mailComposer addAttachmentData:imageData mimeType:@"image/png"
fileName:@"attachment.jpng"];
/* Configure other settings */
[mailComposer setSubject:@""];
[mailComposer setToRecipients:[NSArray arrayWithObjects:@"", nil]];
[mailComposer setToRecipients:[NSArray arrayWithObjects:@"%@", nil]];
[mailComposer setSubject:@"4-4-2 Tactics/Line Up"];
//[mailComposer setMessageBody:AddNotesTextField.text isHTML:NO];
[mailComposer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:mailComposer animated:YES completion:nil];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error{
if (error) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:
[NSString stringWithFormat:@"Error %@", [error description]] delegate:self
cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
[alert show];
}
[self dismissViewControllerAnimated:YES completion:NULL];
}
newMedia = YES;
}
什麼是除了訂單和設置委託的不同方式的改變?我有同樣的問題,但無法修復 – Tumtum 2014-06-04 19:15:06
沒關係,我注意到了現在的完成方法:) – Tumtum 2014-06-04 19:17:08