在我的应用程序中,我想在选项卡栏中添加barbuttonitem。
我在视图中显示了选项卡栏,但我不知道如何在iphone中编程添加工具栏。
谁能给我一些关于我的问题的信息?
提前谢谢你..
发布于 2011-03-04 12:47:25
不能将栏按钮项添加到选项卡栏。
将栏按钮项添加到工具栏
//创建一个BarButtonItem按照您想要的方式配置
self.forwardButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay
                          target:nil action:nil];//创建所有条形按钮的数组
NSArray *toolBarItems = [[NSArray alloc] initWithObjects:forwardButton,nil];//设置工具项
[self.toolBar setItems:toolBarItems];   //向工具栏添加项目
[self addSubview:self.toolBar];编辑
如果您想在BarButtonItems之间添加空格
UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL];发布于 2011-03-04 12:48:34
不能在选项卡栏中添加barbuttonitem。您可以在工具栏中添加barbuttonitem。为此,请查看此链接
http://www.iphonedevsdk.com/forum/iphone-sdk-development/59285-programmatically-add-button-uitoolbar.html
https://stackoverflow.com/questions/5189729
复制相似问题