0
當我完成屏幕截圖並嘗試在應用中發送屏幕截圖時遇到問題。通常情況下,發送文本時可以很好地工作,但一旦發送屏幕截圖,無論取消還是發送電子郵件,屏幕都不會消失。我可否知道這有什麼問題?DismissModaViewController上的郵件編輯器不起作用
這是我的代碼。非常感謝你。
- (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