How can I chage the text color for large titles? I want it to be white.
I tried to set the titleTextAttributes like this:
self.navigationController?.navigationBar.prefersLargeTitles = true
self.navigationController?.navigationBar.titleTextAttributes = [
NSAttributedStringKey.foregroundColor.rawValue: UIColor.white
]
But the text only turns up white when I scroll and it is displayed in the middle as usual.
True, it is ignored for the big title.
This is a temporary workaround, call this in your viewDidAppear:
for view in self.navigationController?.navigationBar.subviews ?? [] {
let subviews = view.subviews
if subviews.count > 0, let label = subviews[0] as? UILabel {
label.textColor = <replace with your color>
}
}