0
所以说我有3个视图控制器,A,B和C.如何为各个导航栏指定标题颜色? Swift
A有黑色背景,B是白色,C是蓝色。
所有这些使用NavigationControllerBars
导航。
如何以编程方式更改navBar标题的颜色?
所以,我有一个白色的标题上A,黑色的B,也许红色的C.
例如从什么我已经收集大家使用:
navigationController?.navigationBar.titleTextAttributes = [NSForegroundAttributeName: UIColor.white]
我是新来的很快,但对我来说,看起来像Obj-C?
这并不为我工作,我不断收到
替换 'NSForegroundColorAttributeName' 与 'NSForegroundColorAttributeName.rawValue'
为错误。
了解如何使用NSAttributedString。 –
[在Swift中使用NSMutableAttributedString更改特定文本的颜色](https://stackoverflow.com/questions/25207373/changing-specific-texts-color-using-nsmutableattributedstring-in-swift) –