Iphone 如何在导航栏上添加5个按钮
如何在导航栏上添加大约5个按钮 我很好,我们可以在左右两侧添加导航按钮 我们使用UIToolbar在导航栏上添加按钮 是任何其他适合导航栏周围五个按钮的方式。在接受apple的地方您可以始终使用[self.navigationController.navigationBar addSubview:abutton]Iphone 如何在导航栏上添加5个按钮,iphone,objective-c,Iphone,Objective C,如何在导航栏上添加大约5个按钮 我很好,我们可以在左右两侧添加导航按钮 我们使用UIToolbar在导航栏上添加按钮 是任何其他适合导航栏周围五个按钮的方式。在接受apple的地方您可以始终使用[self.navigationController.navigationBar addSubview:abutton] NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:5]; // create a standard
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];