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.
It seems that initializing the MFMailComposeViewController UIApplication.shared.statusBarStyle will change to .default... so, saving the state before and setting it again after presentation solved the problem for me:
// save the state, otherwise it will be changed
let sbs = UIApplication.shared.statusBarStyle
let mailComposerVC = MailComposerVC()
mailComposerVC.navigationBar.barTintColor = UINavigationBar.appearance().barTintColor
mailComposerVC.navigationBar.tintColor = UINavigationBar.appearance().tintColor
mailComposerVC.navigationBar.barStyle = UINavigationBar.appearance().barStyle
if MFMailComposeViewController.canSendMail() {
APP_ROOT_VC?.present(mailComposerVC, animated: true, completion: {
// reapply the saved state
UIApplication.shared.statusBarStyle = sbs
})
}
public class MailComposerVC: MFMailComposeViewController {
public override var preferredStatusBarStyle: UIStatusBarStyle {
return UIApplication.shared.statusBarStyle
}
public override var childViewControllerForStatusBarStyle : UIViewController? {
return nil
}
}