My problem is exactly as explained in this question ViewController title color will change change color when back button clicked
I've Navigation Controller -> View Controller (#1) -> Segue to another View Controller (#2)
View Controller #2 has a different title color.
When I click on Back button in View Controller #2 to go back to Home View (#1) it's title color is not changed to what it should be but it remain the title colour of view controller #2.
I've set the correct title color in attribute inspector. I'm also setting title color exclusively in Home View Controller's viewWillAppear but it's colour is still not changed.
I'm wondering what else I need to do? Is there
I've already added code to set title color to white in Home View Controller's viewWillAppear
override func viewWillAppear(_ animated: Bool){
super.viewWillAppear(animated)
print("HomeViewController: viewWillAppear()")
// Mark: - Set navigation bar title color
setTitleColorWhite(vc: self)
activityIndicator.startAnimating()
fetchDetails()
}
And this is setTitleColorWhite
// Mark: - Set navigation bar title color
func setTitleColorWhite(vc: UIViewController){
let attrs = [
NSAttributedStringKey.foregroundColor: UIColor(red:1.00, green:1.00, blue:1.00, alpha:1.0),
NSAttributedStringKey.font: UIFont(name: "SFProText-Medium", size: 17.0)!
]
vc.navigationController?.navigationBar.titleTextAttributes = attrs
}