Reputation: 3301
I have added two buttons to navigation controller one inplace of right button and left button, I want to add a third button just before the right button. How to do it?
UIButton *logo_btn = [UIButton buttonWithType:UIButtonTypeCustom];
[logo_btn setBackgroundImage:[UIImage imageNamed:@"logo-57.png"] forState:UIControlStateNormal];
[logo_btn setFrame:CGRectMake(-2, 0, 47, 47)];
UIBarButtonItem *btnItem1 = [[UIBarButtonItem alloc] initWithCustomView:logo_btn];
self.navigationItem.leftBarButtonItem = btnItem1;
This is how I have added one button at left.
Upvotes: 0
Views: 773
Reputation: 4091
iOS 5 helps you at creating more than 2 barbuttons on the Navigation Bar
self.navigationItem.leftBarButtonItems = [NSArray arrayWithObjects:uibarbuttonInstance1, uibarbuttonInstance2, nil];
same for right buttons
self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:uibarbuttonInstance1, uibarbuttonInstance2, nil];
Upvotes: 4