如何在iphone的选项卡栏程序中添加按钮项
在我的应用程序中,我想在选项卡栏中添加barbuttonitem 我在视图中显示了选项卡栏,但我不知道如何在iphone中添加BarButtonim程序 有人能告诉我我的问题吗如何在iphone的选项卡栏程序中添加按钮项,iphone,Iphone,在我的应用程序中,我想在选项卡栏中添加barbuttonitem 我在视图中显示了选项卡栏,但我不知道如何在iphone中添加BarButtonim程序 有人能告诉我我的问题吗 提前感谢您。您无法将工具栏按钮项添加到选项卡栏 将工具栏按钮项添加到工具栏的步骤 //创建一个BarButtonItem,按照您想要的方式进行配置 self.forwardButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSy
提前感谢您。您无法将工具栏按钮项添加到选项卡栏 将工具栏按钮项添加到工具栏的步骤 //创建一个BarButtonItem,按照您想要的方式进行配置
self.forwardButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay
target:nil action:nil];
//为所有栏按钮创建一个数组
NSArray *toolBarItems = [[NSArray alloc] initWithObjects:forwardButton,nil];
//设置toolar项目
[self.toolBar setItems:toolBarItems];
//将项目添加到工具栏
[self addSubview:self.toolBar];
编辑
如果您想在按钮之间添加空间
UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL];
不能在选项卡栏中添加barbuttonitem。您可以在工具栏中添加barbuttonitem。为此,请查看此链接