Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
Images
Resources/Images.xcassets
AppDelegate.cs
Info.plist
Main.cs
NavBarToolbar.csproj
NavBarToolbar.sln
NavBarViewController.cs
README.md

README.md

id title brief sdk
2484D39E-41AD-E29E-AC9F-C40923876AFD
Add a Nav Bar Bottom ToolBar
This recipe illustrates how to add a toolbar to the bottom of a view.

Recipe

To add a toolbar to the bottom of the view:

  1. Create a toolbar by setting an array of UIBarButtonItems:
this.SetToolbarItems( new UIBarButtonItem[] {
    new UIBarButtonItem(UIBarButtonSystemItem.Refresh, (s,e) => {
        Console.WriteLine("Refresh clicked");
    })
    , new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) { Width = 50 }
    , new UIBarButtonItem(UIBarButtonSystemItem.Pause, (s,e) => {
        Console.WriteLine ("Pause clicked");
    })
}, false);
  1. Finally, to show the Toolbar:
this.NavigationController.ToolbarHidden = false;

Additional Information

If you are creating a complex toolbar with many items, it might be easier to construct the buttons separately:

var refreshButton = new UIBarButtonItem(UIBarButtonSystemItem.Refresh, (s, e) => {
    Console.WriteLine("Refresh clicked");
})

var pauseButton = new UIBarButtonItem(UIBarButtonSystemItem.Pause, (s, e) => {
    Console.WriteLine("Pause clicked");
})

var spacer = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) { Width = 50 };

this.SetToolbarItems( new UIBarButtonItem[] {
    refreshButton, spacer, pauseButton
}, false);