我在使用MFMailComposeViewController时遇到了麻烦。
当我点击一个按钮时,MFMailComposeViewController的一个实例应该出现:
http://postimg.org/image/i24gn4oi7/
但是当它发生时,会发生这种情况:
http://postimg.org/image/kdwm0isrl/
以下是代码:
- (IBAction)actionEmailComposer {
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
NSMutableArray *email = [[NSMutableArray alloc] initWithObjects:@"factto@gmail.com", nil];
[mc setToRecipients:email];
//[mc setSubject:@"SUBJECT_HERE"];
[mc setMessageBody:@"Referência: \nCor:" isHTML:NO];
mc.modalPresentationStyle = UIModalPresentationFullScreen;
// Present mail view controller on screen
[self presentViewController:mc animated:YES completion:NULL];
}
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
{
NSLog(@"Mail sent");
UIAlertView *msg = [[UIAlertView alloc] initWithTitle:@"Obrigado!" message:@"Logo logo entraremos em contato!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[msg show];
}
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}
[self dismissViewControllerAnimated:YES completion:NULL];
}
实际上,在iPad上它确实可以正常工作,它只发生在iPhone上! 到底是怎么回事?我做错了什么?
提前致谢。
答案 0 :(得分:0)
您呈现邮件视图控制器的视图控制器需要全屏显示在前面,如果不是视图的某些部分将无法正确响应触摸和/或正确显示(当您见)。