iOS 7中MFMailComposeViewController的状态栏变为黑色

59

我的iOS 7应用程序中有一个反馈按钮,使用MFMailComposeViewController。用户点击此按钮后,邮件组合器会打开,但状态栏会变为黑色。是否有人知道我该怎么办?

我只在iOS 7上遇到这个问题。我正在为iOS 7自定义我的应用程序。

    MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
            mailController.mailComposeDelegate = self;

            [mailController setSubject:@"Feedback"];
            // Fill out the email body tex
            NSString *emailBody = [NSString stringWithFormat:@"testest"],
                                   [UIDevice currentDevice].model,
                                   [UIDevice currentDevice].systemVersion];
            [mailController setMessageBody:emailBody isHTML:NO];
            [mailController setToRecipients:[NSArray arrayWithObjects:@"support@test.com",nil]];

            dispatch_async(dispatch_get_main_queue(), ^{
                [self presentModalViewController:mailController animated:YES];
}
13个回答

0
在我的情况下,我正在使用“基于视图控制器的状态栏外观”,并呈现具有自定义segue转换的模态视图控制器,然后从那里呈现MFMailComposeViewController。 在这种情况下,默认情况下,iOS仅尊重/使用“呈现”或“根”视图控制器的preferredStatusBarStyle方法。
因此,一旦我在我的根视图控制器中覆盖了childViewControllerForStatusBarStyle和我的模态视图控制器中的preferredStatusBarStyle,一切都按预期工作...就像这样:
// in RootViewController.m ...
- (UIViewController *)childViewControllerForStatusBarStyle {
    return self.modalViewController;
}

// in ModalViewController.m ...
- (UIStatusBarStyle)preferredStatusBarStyle {
    if (self.mailController != nil)
        return UIStatusBarStyleDefault;
    return UIStatusBarStyleLightContent;
}

0
[self presentViewController:mailViewController animated:YES completion:^(void) { [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES]; }];

0
iOS 7引入了一个名为prefersStatusBarHidden的方法,但在这种情况下使用它并不容易。当模态视图呈现时,您可能更喜欢使用UIApplicationstatusBarHidden属性。

谢谢你的回答。我已经测试过了:[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; 但是问题依旧 :( - NoBody

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接