I am currently developing a chat application and within this I have to add more then 1 left bar button in navigation bar. I am developing it using xib file.
I already added left and right bar button now I want to add 2 more in the left side of navigation bar.
UINavigationItem Class Reference having property of leftBarButtonItems and rightBarButtonItems so you can add multiple UIBarButtonItem
in your navigation control using following example code:
UIBarButtonItem *FirstButton = [[UIBarButtonItem alloc]
initWithTitle:@"First"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(AcionFirst:)];
UIBarButtonItem *secondButton = [[UIBarButtonItem alloc]
initWithTitle:@"Second"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(AcionSecond:)];
self.navigationItem.leftBarButtonItems= [NSArray arrayWithObjects:FirstButton,secondButton,nil];
-(void)AcionFirst:(id)sender
{
//do something for first bar button
}
-(void)AcionSecond:(id)sender
{
//do something for second bar button
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.