-1

Im not sure how to change the color of the following nav bar title:

with the following code:

override func viewDidLoad() {
    super.viewDidLoad()

    let navigationBarAppearace = UINavigationBar.appearance()
    navigationBarAppearace.tintColor = UIColor(red: 150/255, green: 150/255, blue: 150/255, alpha: 1)
}

i am able to change the color of "Upload Post" and "Share"

but im not sure how to change the middle title "Upload Post" to a different color

enter image description here

how do i change the color to white for example?

Gino Sesia
  • 383
  • 2
  • 4
  • 14
  • 3
    Does this answer your question? [NavigationBar bar, tint, and title text color in iOS 8](https://stackoverflow.com/questions/26008536/navigationbar-bar-tint-and-title-text-color-in-ios-8) – vpoltave Jul 07 '20 at 09:29

2 Answers2

1

Title color can be changed from Storyboard. Tapp on navigation bar in your navigation View controller and change in attribute inspector

enter image description here

or you can do it programmatically in your view controller ViewDIDLOAD

if you prefer large title

 navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red]

or

navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red]
Ovais Khan
  • 74
  • 4
-3

let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.lightGray] navigationController?.navigationBar.titleTextAttributes = textAttributes

Tipu
  • 19
  • 4