iPhone 导航控制工具栏项目
MonoTouch 是首选,但 Obj-C 也可以
我的 MainWindow.xib 有一个 NavigationView 和一个 View。该视图看起来很好并且可以工作,但我需要将按钮添加到作为导航视图一部分的工具栏。我可以在IB中看到工具栏。
在此视图中,我尝试向工具栏添加按钮,但它们没有出现。
UIBarButtonItem btnBrowse = new UIBarButtonItem ("Browse", UIBarButtonItemStyle.Bordered, null);
UIBarButtonItem btnOptions = new UIBarButtonItem ("Options", UIBarButtonItemStyle.Bordered, null);
UIBarButtonItem btnBibles = new UIBarButtonItem ("Bibles", UIBarButtonItemStyle.Bordered, null);
UIBarButtonItem btnSpacer = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace);
void WireUpCommands ()
{
this.NavigationController.Toolbar.SetItems (new[] { btnOptions, btnSpacer, btnBrowse, btnSpacer, btnBibles }, false);
}
MonoTouch preferred, but Obj-C ok too
My MainWindow.xib has a NavigationView and a View. The View appears nicely and works, but I need to add buttons to the toolbar that is part of the NavigationView. I can see the toolbar in IB.
In this View I try to add buttons to the toolbar, but they do not appear.
UIBarButtonItem btnBrowse = new UIBarButtonItem ("Browse", UIBarButtonItemStyle.Bordered, null);
UIBarButtonItem btnOptions = new UIBarButtonItem ("Options", UIBarButtonItemStyle.Bordered, null);
UIBarButtonItem btnBibles = new UIBarButtonItem ("Bibles", UIBarButtonItemStyle.Bordered, null);
UIBarButtonItem btnSpacer = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace);
void WireUpCommands ()
{
this.NavigationController.Toolbar.SetItems (new[] { btnOptions, btnSpacer, btnBrowse, btnSpacer, btnBibles }, false);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了。现在,每个视图都作为 NavigationController 的子视图控制其自己的工具栏。
Found it. Each view now controls it's own toolbar as a child of the NavigationController.