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

 
Background:

 
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

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Leave a comment

Leave a Reply