Mandar Apte

UI/UX Designer from Mumbai, Maharashtra, India.

How to add four or more UIBarButtonitem at navigation bar with custom image through code?

I assume you have gone through an earlier article related to this topic called:

How to add four or more navigation bar buttons in your iOS App XCode Project

Background:
Now you will be wondering how you can add a fourth button to the navigation bar of your iOS app with a custom image through code

Here is the solution:


// add our custom image button as the nav bar's custom right view
let addButton = UIBarButtonItem(image: UIImage(named: "Email"), style: .bordered, target: self, action: #selector(action(_:)))
self.navigationItem.rightBarButtonItem = addButton

Note: change your desired image name at second line ‘Email’

Hope it helps,

Thanks & Regards
Mandar Apte

Comments

Leave a Reply

Sponsors


Search