Ios UINavigationBar.Apprance().titleTextAttributes在swift中不起作用

Ios UINavigationBar.Apprance().titleTextAttributes在swift中不起作用,ios,swift,Ios,Swift,UINavigationBar.Apprance().titleTextAttributes不工作。Swift代码如下 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { UINavigationBar.appearance().translucent = false UINav

UINavigationBar.Apprance().titleTextAttributes不工作。Swift代码如下

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
}

有什么想法吗?

在Appdelegate didFinishLaunchingWithOptions方法中添加以下代码

 let navFont = UIFont(name: "HelveticaNeue-Bold", size: 30.0)
 UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor : UIColor.blackColor(), NSAttributedStringKey.font: navFont!]

在Appdelegate didFinishLaunchingWithOptions方法中添加以下代码

 let navFont = UIFont(name: "HelveticaNeue-Bold", size: 30.0)
 UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor : UIColor.blackColor(), NSAttributedStringKey.font: navFont!]

这有用吗?let attributes:Dictionary=[NSFontAttributeName:UIFont.systemFontOfSize(19.0),NSForegroundColorAttributeName:UIColor.whiteColor()]UIBarButtonim.appearance().setTitleTextAttributes(attributes,forState:UIControlState.Normal)@LoïsDiQual谢谢你的代码很好,对我来说工作很好,我测试了你的代码这有帮助吗?let attributes:Dictionary=[NSFontAttributeName:UIFont.systemFontOfSize(19.0),NSForegroundColorAttributeName:UIColor.whiteColor()]UIBarButtonim.appearance().setTitleTextAttributes(attributes,forState:UIControlState.Normal)@LoïsDiQual谢谢你的代码很好,我测试了你的代码