0
私はスクリーンショットを完了し、アプリでスクリーンショットをメールで送信しようとすると問題が発生します。通常、テキストを送信するときは完全に機能しますが、一度スクリーンショットを送信すると、キャンセルや電子メールの送信は行われません。画面は表示されません。これの問題は何か分かりますか?DismissModaViewController on Mailコンポーザーが動作しない
ここに私のコードです。どうもありがとうございました。
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
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 addAttachmentData:imageData mimeType:@"image/jpeg" fileName:@"attachment.jpg"];
/* Configure other settings */
[self presentModalViewController:mailComposer animated:YES];
}
}
}
- (void)mailComposeController:(MFMailComposeViewController*)controller{
[self dismissModalViewControllerAnimated:YES];
}
ありがとうございました。しかし、画面は以前と同じになった。メールの作曲家はただ離れません。 – Clarence
デリゲートをmailComposeDelegateに変更することで問題は解決しました。 – Clarence