I'm trying to change the color of my navigator bar but I found that it's only impossible if the navigator is the root one.
I'm trying this:
self.navigationController?.navigationBar.translucent = true
self.navigationController!.navigationBar.barTintColor = UIColor.blueColor()
All my Viewcontrollers
are related to navigator controllers. However nothing is changed. In fact I tried to make the same things from storyboard but it works only if I'm in the first navigator.
I tried to read everything related to this problem but found nothing
I could add any item to the navigator bar like this
let HomeImage = UIImage(named: "home")!
let Home : UIBarButtonItem = UIBarButtonItem(image: HomeImage, style: .Plain, target: self, action: "home:")
navigationItem.rightBarButtonItem = Home
Swift 4.2:
Swift 3.x:
If your view controller is embedded in navigation controller then you can remove this default navigation bar and can use a custom navigation bar for that view controller.
Then you can do look like
Updated for Swift 3
Swift 4
For changing the navigation bar theme color throughout the full app you can do this by using UiNavigation bar appearance.
Make the following update to the AppDelegate.Swift file i.e.
UINavigationBar.appearance().barTintColor = UIColor(red:x.xx, green:x.xx, blue:x.xx, alpha:1.0)
Refer to example below