如何在 Swift 4 中将 navigationItem.title 更改为白色?
let uid = Auth.auth().currentUser?.uid
Database.database().reference().child("users").child(uid!).observeSingleEvent(of: .value, with: {(snapshot) in
if let dictionary = snapshot.value as? [String: AnyObject] {
self.navigationItem.title = dictionary["name"] as? String
self.navigationController?.navigationBar.prefersLargeTitles = true
}
},withCancel: nil)
最佳答案
您可以使用此更改标题颜色:
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
关于swift - 如何在 Swift 4 中将 navigationItem.title 更改为白色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50554081/