UINavigationBar.apperance()。titleTextAttributes无效。 Swift Code在下面。
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
UINavigationBar.appearance().translucent = false
UINavigationBar.appearance().barTintColor = UIColor.greenColor()
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]
return true
}
有什么想法吗?
答案 0 :(得分:0)
在Appdelegate didFinishLaunchingWithOptions方法
中添加以下代码 let navFont = UIFont(name: "HelveticaNeue-Bold", size: 30.0)
UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor : UIColor.blackColor(), NSAttributedStringKey.font: navFont!]