MFMailComposeViewController in iOS 7 statusbar are black

前端 未结 13 821
不知归路
不知归路 2020-12-04 23:20

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.

13条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 23:51

    Solution for Swift3

    Add this to your ViewController:

    extension MFMailComposeViewController {
        open override var preferredStatusBarStyle: UIStatusBarStyle {
            return .lightContent
        }
        open override var childViewControllerForStatusBarStyle: UIViewController? {
            return nil
        }
    }
    

    Set View controller-based status bar appearance >> YES as below:

    Thanks to @SoftDesigner

    Another cleaner solution that may not change other settings in your app. While presenting the Mail VC change the status bar in the completion block:

    controller.present(mailComposeViewController, animated: true) {
                UIApplication.shared.statusBarStyle = .lightContent
            }
    

提交回复
热议问题