This is my design in Sketch:
Sketch says that the blue color is 70,164,239.
So I have the following code for my tab:
UINavigationBar.appearance().barTintColor = UIColor(red: 70.0/255.0, green: 164.0/255.0, blue: 239.0/255.0, alpha: 1.0)
UINavigationBar.appearance().tintColor = UIColor.clearColor()
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()]
And the following for the view underneath (inside an action):
self.two_buttons_view.backgroundColor = UIColor(red: 70.0/255.0, green: 164.0/255.0, blue: 239.0/255.0, alpha: 1.0)
But look what's going on, the Navigation Bar color is always a little lighter than the color of the view. With this light blue there's only a slight difference but if I go with a darker blue it gets much more noticeable. It appears that the navigation bar's colors are never as rich as the rest of pages views are:
The tintColor
is a tint color. It combines with the translucency (is that a word?) of the bar, along with what's behind the bar, to give some other resulting color.
If you want full control over the actual color of a navigation bar, set its translucent
to false
and then give it a background image consisting of a rectangle of the desired color - and no tint color.