Search code examples
iosswiftuinavigationcontrolleruinavigationbaruicolor

Set color for all UINavigationBars


I have an app with multiple UINavigationControllers. Now I want to set their background color to the same color. I wrote this into the application method of AppDelegate:

UINavigationBar.appearance().backgroundColor = UIColor.darkGray

The same statement for UITabBars works:

UITabBar.appearance().barTintColor = UIColor.darkGray

What is my mistake?

Thanks for your help!


Solution

  • It's gotta be UINavigationBar.appearance().barTintColor = UIColor.darkGray.