MFMailComposeViewController

MFMailComposeViewController

我尝试使用MFMailComposeViewController,但是在显示视图时,看不到“取消并发送”按钮。 VC具有白色。我还尝试更改了NavigationBar的某些颜色,但是没有任何效果。
 设备使用的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];
 //...

关于ios - MFMailComposeViewController取消和发送按钮未显示,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48138169/

10-12 02:53