id | title | brief | sdk | |||||
---|---|---|---|---|---|---|---|---|
79698AE6-8B70-7189-D52D-2D1801EEB833 |
Add a Nav Bar Right Button |
This recipe shows how to add a right button to a navigation bar. |
|
To add a button to the UINavigationBar
using a built-in icon from the
UIBarButtonSystemItem
enumeration:
this.NavigationItem.SetRightBarButtonItem(
new UIBarButtonItem(UIBarButtonSystemItem.Action, (sender,args) => {
// button was clicked
})
, true);
To add a button to the UINavigationBar
using a custom image:
this.NavigationItem.SetRightBarButtonItem(
new UIBarButtonItem(UIImage.FromFile("some_image.png")
, UIBarButtonItemStyle.Plain
, (sender,args) => {
// button was clicked
})
, true);
To remove the button:
this.NavigationItem.SetRightBarButtonItem(null, true);