【发布时间】:2017-08-21 11:19:16
【问题描述】:
我在更改 MFMessageComposeViewController 上导航栏的背景颜色时遇到问题。
我试过这段代码:
UINavigationBar.appearance().barTintColor = Configuration.Colors.navigationBarBackgroundColor
UINavigationBar.appearance().backgroundColor = UIColor.green
UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont(name: "Roboto-Regular", size: 18)!, NSForegroundColorAttributeName: UIColor.white] as [String: AnyObject]
let composer = MFMessageComposeViewController()
self?.present(composer, animated: true) {
UIApplication.shared.statusBarStyle = .lightContent
}
这是行不通的。最奇怪的是,当我为MFMailComposeViewController 做同样的事情时它确实有效。
我也试过像这样直接在作曲家上改变颜色。
composer.navigationBar.tintColor = Configuration.Colors.navigationBarBackgroundColor
【问题讨论】:
-
请查看此链接 [Link to set navigation on mail composer ](stackoverflow.com/questions/39453933/…)
-
更改 info.plist 行查看基于控制器的状态栏外观并将其设置为 NO
-
设置背景颜色的属性是
composer.navigationBar.barTintColor试试就行了
标签: ios swift navigationbar mfmailcomposeviewcontroller