How to set font & color of the title in UINavigationBar using iOS5 appearance API?

后端 未结 7 1326
北恋
北恋 2020-12-04 10:50

I have a multiple View Controllers and I want to set the font color of all to red.

 [[UINavigationBar appearance] setFont:[UIFont boldSystemFontOfSize:12.0]]         


        
7条回答
  •  没有蜡笔的小新
    2020-12-04 11:28

    Doing this on iOS 8+ and in Swift. There isn't a setTitleTextAttributes for the appearance object. Instead, do this:

    UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName : AppTheme.fontWithSize(18)]
    

提交回复
热议问题