这是我的密码
-(IBAction)emailButtonPressed :(UIButton *)sender {
if (![MFMailComposeViewController canSendMail]) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:@"Mail has not been set up on this device" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alertView show];
return;
}
NSString *targetFile = [self saveCompleteImage];
MFMailComposeViewController *mailpicker = [[MFMailComposeViewController alloc] init];
[mailpicker setMailComposeDelegate:self];
NSString *mimeType = [StringHelper getMimeType:targetFile];
[mailpicker addAttachmentData:[NSData dataWithContentsOfFile:targetFile] mimeType:mimeType fileName:[targetFile lastPathComponent]];
[mailpicker setSubject:[self.currentDocument getNameForUntitled]];
mailpicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self.presentedViewController presentViewController:mailpicker animated:YES completion:nil];
}这不是在展示邮递员。请告诉我我哪里错了。
发布于 2013-08-16 07:07:26
此代码的问题是:
[self.presentedViewController presentViewController:mailpicker animated:YES completion:nil];你需要使用:
[self presentViewController:mailpicker animated:YES completion:nil];或
[self.presentingViewController presentViewController:mailpicker animated:YES completion:nil];检查ModalViewControllers参考以了解presentedViewController和presentingViewController之间的区别
https://stackoverflow.com/questions/18267605
复制相似问题