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

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


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


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

Here is the solution:


// add our custom image button as the nav bar's custom right view
    UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Email"]
                                                                  style:UIBarButtonItemStyleBordered 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

Mandar Apte

This website contains a design articles blog by Mandar Apte. He writes and shares his iOS development, graphic, web, & animation film design experience through articles. Mandar is Mumbai based multi-disciplinary designer with expertise in UI, UX, Logo, Symbol, and Brand Identity design. He is an alumnus of Sir J. J. Institute of Applied Art, Mumbai. He currently runs his studio in the heart of the city of Mumbai.

Leave a Reply

Your email address will not be published. Required fields are marked *