Pic显示在下方。
在我的应用中,已添加电子邮件提示,但状态栏现在为黑色,如何将其更改为白色风格?
if MFMailComposeViewController.canSendMail() {
let composeMail = MFMailComposeViewController()
composeMail.mailComposeDelegate = self
// configs
composeMail.setToRecipients(["kylebing@163.com"])
composeMail.setSubject("【饥荒口袋】反馈")
composeMail.setMessageBody("问题页面:\n\n\n\n建议:\n", isHTML: false)
composeMail.navigationBar.tintColor = UIColor.white.withAlphaComponent(0.85) // Mail VC's Button Color
// TODO: - Change status bar color
// show it
self.present(composeMail, animated: true, completion: nil)
}
答案 0 :(得分:0)
在呈现邮件编辑器
之前调用此方法func setStatusBarBackgroundColor(color: UIColor) {
guard let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView else { return }
statusBar.backgroundColor = color
}
答案 1 :(得分:0)
尝试在完成处理程序中设置statusBarStyle
present
邮件控制器,如此
self.present(composeMail, animated: true, completion:{ () in
UIApplication.shared.statusBarStyle = UIStatusBarStyle.lightContent
})
希望它会奏效。
答案 2 :(得分:-1)
在viewWillAppear中:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent
self.navigationController.navigationBar.translucent = false
self.navigationController.navigationBar.opaque = false
self.navigationController.navigationBar.barTintColor = UIColor.blueColor()}
要更改整个应用程序的状态栏颜色,请在app delegate中编写以下代码行
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent
进入您的app代理人didFinishLoading。