Tutorial – Set UINavigation Bar Title Image
Making the UINavigation bar have a title image of your choice is easy with two lines of code. I have setup a XCode project with a simple navigation controller as the root view controller of the default view. It looks like:
First of all we have added the following evox.png as follows to our assets.xcassets for the background image we will be using in this tutorial.
Now to change the navigation bar title image simply use the following code:
override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let imgTitle = UIImage(named: "evox") navigationItem.titleView = UIImageView(image: imgTitle) }
Now your navigation bar will have a background image as follows: