我有标准的UIBarButtonItem
UIBarButtonItem *share = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(share:)];
如何将她添加到UIToolBar?我试过了
self.toolbarItems = [NSArray arrayWithObject:share];
但它不起作用 . 需要你的帮助 .
4 回答
你能比“它不起作用”更具体吗?
如果您尝试将项目添加到已有项目的工具栏,则需要修改项目数组:
确保以编程方式将工具栏设置为IBOutlet或添加工具栏
确保工具栏不是't hidden; you could try adding the following to your view controller' s
viewWillAppear:animated:
方法:[toolbar setItems:[NSArray arrayWithObject:share] animated:YES];