下面是针对上述问题的代码行。
此问题发生在 Swift 4.1
中。
let textAttributes = [NSAttributedStringKey.foregroundColor:UIColor.white]
navigationController?.navigationBar.titleTextAttributes = textAttributes
最佳答案
我已经通过替换属性字符串的键解决了这个问题。
这是我更新后的代码:
let textAttributes = [NSForegroundColorAttributeName : UIColor.white]
navigationController?.navigationBar.titleTextAttributes = textAttributes
关于ios - 类型 'NSAttributedStringKey'(又名 'NSString')没有成员 'foregroundColor',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50325873/