iOS Programming Cookbook
上QQ阅读APP看书,第一时间看更新

Navigation bar color

Last but not least is changing the color of the navigation bar. It's very rare to find an app that has a different color for the navigation bar in different screens. Most of the apps have one navigation color that is unique for all screens. We will now see how to set the navigation bar coloring globally in your app. Open the AppDelegate.swift file, and add these lines of code:

UINavigationBar.appearance().tintColor = UIColor.blackColor() 
UINavigationBar.appearance().barTintColor = UIColor.cyanColor()

We changed the default blue tint color to black color and bar tint color (background color) to cyan color. When you build and run, you should see something like this: