Skip to content

Instantly share code, notes, and snippets.

@pierceboggan
Last active September 22, 2016 14:15
Show Gist options
  • Save pierceboggan/5901101 to your computer and use it in GitHub Desktop.
Save pierceboggan/5901101 to your computer and use it in GitHub Desktop.
Shows off using a UIButton with a background image as a UIBarButtonItem, and handling touch events accordingly.
var composeButton = new UIButton (new RectangleF (0, 0, 20, 20));
composeButton.SetBackgroundImage (Images.ComposeButton, UIControlState.Normal);
composeButton.SetBackgroundImage (Images.ComposeButtonHighlighted, UIControlState.Highlighted);
composeButton.AddTarget((object sender, EventArgs args) => PresentViewController (new PrayerComposeDialog (), true, null),
UIControlEvent.TouchUpInside);
ComposeButton = new UIBarButtonItem (composeButton);
NavigationItem.RightBarButtonItem = ComposeButton;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment