MFMailComposeViewController取消并发送未见的按钮

时间:2018-01-07 14:33:23

标签: ios objective-c mfmailcomposeviewcontroller

我曾尝试使用MFMailComposeViewController,但是当显示View时,看不到取消和发送按钮。 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:@[@"myTestEmail@myEmail.com"]];

    [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];
}  

1 个答案:

答案 0 :(得分:1)

尝试在启动MFMailComposeViewController之前设置导航栏外观:

[UINavigationBar appearance].tintColor = [UIColor yourColor];
 MFMailComposeViewController *mailVC = [[MFMailComposeViewController alloc] init];
 //...