Customize UINavigationBar Appearance Programmatically in UIViewController

This short Swift code snippet demonstrates how we can customize UINavigationBar appearance in UIViewController. The blow code covers:

  • Set UINavigationBar tint color
  • Set Navigation bar Title colour
  • Set navigation bar ItemButton tint colour
  • Set Navigation bar background image
import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        // Do any additional setup after loading the view, typically from a nib.
                // Set navigation bar background colour
        self.navigationController!.navigationBar.barTintColor = UIColor.yellow
        // Set navigation bar title text colour
        self.navigationController!.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:]
        // Set Navigation bar background Image
        let navBgImage:UIImage = UIImage(named: "bg_blog_navbar_reduced.jpg")!
        self.navigationController!.navigationBar.setBackgroundImage(navBgImage, for: .default)


    override func didReceiveMemoryWarning() {
        // Dispose of any resources that can be recreated.


Watch this video tutorial with demonstration on how to customize UINavigationBar Appearance.

Customize UINavigationBar appearance in Swift

Learn iOS Development with these Video Courses

How to Make a Freaking iPhone App - iOS 10 and Swift 3
icon icon

iOS 10 & Swift 3: From Beginner to Paid Professional

The Complete iOS 10 Developer Course - Build 21 Apps

Swift 3 - Learn to Code with Apple's New Language
icon icon

Learn How to Build Mobile Apps for iOS with Swift, PHP and MySQL
icon icon

Follow me on one of your favourite social networks to learn about new video tutorials and code examples:

Twitter: @SwiftVideoBlog
Google Plus:
Facebook: Swift Developer Blog on Facebook