views:

240

answers:

1

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); 
}
A: 

Found it. Each view now controls it's own toolbar as a child of the NavigationController.

this.ToolbarItems = new[] { btnOptions, btnSpacer, btnBrowse, btnSpacer, btnBibles };
BahaiResearch.com