我曾尝试使用 MFMailComposeViewController,但是当显示视图时,没有看到取消和发送按钮。VC 为白色。我还尝试更改导航栏的一些色调,但没有任何效果。设备使用 iPhone 8
任何正确方向的帮助都会有所帮助
下面是相同的代码。
MFMailComposeViewController *mailVC = [[MFMailComposeViewController alloc] init];
mailVC.mailComposeDelegate = self;
[mailVC setSubject:@"Looko App!"];
[mailVC setMessageBody:@"Found and sent using Demo App!" isHTML:NO];
[mailVC setToRecipients:@[@"[email protected]"]];
[self presentViewController:mailVC animated:YES completion:nil];
委托回调如下
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result) {
case MFMailComposeResultSent:
NSLog(@"Email sent");
break;
case MFMailComposeResultSaved:
NSLog(@"Email saved");
break;
case MFMailComposeResultCancelled:
NSLog(@"Email cancelled");
break;
case MFMailComposeResultFailed:
NSLog(@"Email failed");
break;
default:
NSLog(@"Error occured during email creation");
break;
}
[self dismissViewControllerAnimated:YES completion:NULL];
}
在启动 MFMailComposeViewController 之前尝试设置导航栏外观:
[UINavigationBar appearance].tintColor = [UIColor yourColor];
MFMailComposeViewController *mailVC = [[MFMailComposeViewController alloc] init];
//...
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句