如何在iOS Swift 2.0中更改导航项目标题的背景和前景颜色?

时间:2016-07-14 02:31:16

标签: ios swift

大家好...... 我在swift 2.0中的 navigationitem.title 中对 forground 颜色属性感到困惑..我已经尝试以下这些代码

    navigationController?.navigationBar.barTintColor =  UIColor(red: 0.3, green: 0.5, blue: 0.1, alpha: 1.0)
    navigationController!.navigationBar.tintColor = UIColor.whiteColor()
  navigationController?.navigationItem.titleView?.backgroundColor = UIColor.whiteColor()
      navigationController?.navigationItem.titleView?.backgroundColor = UIColor.whiteColor()

为所有viewcontroller更改 BarColor和BackButton颜色(连接为push segue) 但我无法访问 navigationItem.title颜色 方法。 s o如何更改此标题颜色? ..提前感谢:);)

Screen Shot

1 个答案:

答案 0 :(得分:2)

如果您的意思是尝试更改标题的文字颜色,则需要将以下内容放入{{1>} application(_:didFinishLaunchingWithOptions:)

AppDelegate.swift