代码之家  ›  专栏  ›  技术社区  ›  Godfather

iOS顶部导航栏设置标题颜色

  •  0
  • Godfather  · 技术社区  · 6 年前

    我有一个uinavigationbar,其 preferredlargestitles=true。我尝试了所有的方法,但我无法改变顶部导航栏的白色。 .

    3 回复  |  直到 6 年前
        1
  •  1
  •   Scriptable    6 年前

    您应该能够使用TintColor属性更改条形按钮项的文本颜色。

    override func viewdidload()。{
    super.viewdidload()。
    
    self.title=“测试”
    导航控制器?.navigationbar.preferslargetitles=真
    导航控制器?.NavigationBar.TintColor=.Red
    }
    < /代码> 
    
    

    enter image description here

        2
  •  0
  •   Alastar    6 年前

    largeTitleTextAttributes 会完成任务的!

    这是一个示例:

    navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.gray]
    
        3
  •  0
  •   Godfather    6 年前

    navigationcontroller.navigationbar.tingcolor=。随便怎么做!