Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何在导航栏上添加5个按钮_Iphone_Objective C - Fatal编程技术网

Iphone 如何在导航栏上添加5个按钮

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

如何在导航栏上添加大约5个按钮

我很好,我们可以在左右两侧添加导航按钮

我们使用UIToolbar在导航栏上添加按钮

是任何其他适合导航栏周围五个按钮的方式。在接受apple的地方

您可以始终使用[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];