如何将button添加到iPadpopup窗口中的工具栏?
希望有人在这里征服了这个,因为这让我疯狂。 我的应用程序包含一个用于input和编辑信息的popup窗口。 今天我学到了可以在popover底部显示一个工具栏,这很好 – 除了我不能在我的生活中得到任何button显示在工具栏上。 这是我们开始的地方:
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: editorViewer]; //*** This makes the toolbar visible [navigationController setToolbarHidden:NO animated:NO]; //*** Create a 'trash' button UIBarButtonItem *trashButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target: nil action: @selector(deleteItem)]; //*** Create an array of buttons NSArray *buttons = [NSArray arrayWithObjects: trashButton, nil];
我已经尝试了以下每一个添加button,没有成功:
navigationController.toolbar.items = buttons;
和
[navigationController setToolbarItems: buttons]
和
[navigationController.toolbar setItems: buttons animated: NO];
我得到一个漂亮的小工具栏,没有button。
任何想法我做错了什么?
当您在导航控制器上设置工具栏隐藏状态时,工具栏项将从导航控制器的顶视图控制器的toolbarItems属性中获取。
在你的情况
editorView.toolbarItems = buttons;
要么
[editorView setToolbarItems:buttons];
而
[navigationController setToolbarHidden:NO animated:NO];
保持不变。
- 缩放时保持UIButton相对
- 如何使程序在继续执行下一个命令之前等待asynchronousNSURLConnection完成?
- animation只改变其他属性的图层属性?
- 连接UITableView数据源/委托到基础UIViewController类
- 在iOS 12中生成的密码
- 苹果是否提供了它使用的本地化术语的索引?
- 无法运行bms-samples-cordova-hellopush – 找不到bms_samples_cordova_push-Swift.h文件
- 阻止iframe中的链接导航/接pipecordova webview,特别是在ios中
- 无法通过AVPlayer通过HTTP播放mp3文件