搜到的答案都是这种:
self.navigationController?.navigationBar.titleTextAttributes=[NSForegroundColorAttributeName:UIColor.orange, NSFontAttributeName : UIFont.systemFont(ofSize: 25) ]
但程序报错:
Use of unresolved identifier 'NSForegroundColorAttributeName'
目前正确写法应该是:
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor:UIColor.orange,
NSAttributedStringKey.font : UIFont.systemFont(ofSize: 25)]