NoBody NoBody - 23 days ago 10
iOS Question

MFMailComposeViewController in iOS 7 statusbar are black

i have a feedback button in my ios 7 application with MFMailComposeViewController. After the user click this button the mailcomposer open but the statusbar changed to black. Have anybody a idea what can i do?

i have this problem only with ios7. i customizing my app for ios7.

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

Answer

Set the UIApplication statusBarStyle in the completion block of presentViewController for your MFMailComposeViewController. i.e.

    MFMailComposeViewController *mailVC = [[MFMailComposeViewController alloc] init];
    [self.navigationController presentViewController:mailVC animated:YES completion:^{
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    }];

You may also need to add and/or set "View controller-based status bar appearance" to NO in your Info.plist file.