How to add 5 button on NavigationBar
How to add on around 5 buttons on UINavigation bar .
I fine we can add button to left and right for the navigation
using UIToolbar we add the button on navigation bar.
开发者_高级运维Is any other way which fit around five button's around navigation bar. where apple is accepted
You can always use [self.navigationController.navigationBar addSubview: abutton];
.
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:5];
// create a standard "1" button
UIBarButtonItem* bi = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:NULL];
bi.style = UIBarButtonItemStyleBordered;
[buttons addObject:bi];
[bi release];
//for spacer
bi = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
[buttons addObject:bi];
[bi release];
// create a standard "2" button
bi = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh:)];
bi.style = UIBarButtonItemStyleBordered;
[buttons addObject:bi];
[bi release];
// and so on you can create rest button in the same way and add to tools
// stick the buttons in the toolbar
[tools setItems:buttons animated:NO];
[buttons release];
// and put the toolbar in the nav bar
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools];
[tools release];
精彩评论