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

Leave a Reply

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