I would like to create a NavigationBar with images as buttons on the right side of the NavigationBar.
Something like below Snapshot
How can I achieve this?
Hope This Helps
viewController.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage.png"]];
UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage2.jpg"]]];
viewController.navigationItem.rightBarButtonItem = item;
Here the Code, Just call below Methods From viewDidLoad
method
- (void)addCustomButtonOnNavBar
{
UIBarButtonItem * item1= [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"passImageNmae1"] style:UIBarButtonItemStylePlain target:self action:@selector(yourButtonAction1)];
UIBarButtonItem * item2= [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"passImageNmae2"] style:UIBarButtonItemStylePlain target:self action:@selector(yourButtonAction2)];
NSArray * buttonArray =[NSArray arrayWithObjects:item1,item2 ,nil];
self.navigationItem.rightBarButtonItems =buttonArray;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With