Skip to content

Instantly share code, notes, and snippets.

@nicwise
Created June 5, 2012 13:22
Show Gist options
  • Save nicwise/2874948 to your computer and use it in GitHub Desktop.
Save nicwise/2874948 to your computer and use it in GitHub Desktop.
public static void SetAppearance()
{
if (Util.IsIOS5OrBetter)
{
UINavigationBar.Appearance.SetBackgroundImage(
Resources.NavBarHeaderBackground,
UIBarMetrics.Default);
UIBarButtonItem.Appearance.SetBackgroundImage(
Resources.BarButtonNormal.CreateResizableImage(new UIEdgeInsets(0,5,0,5)),
UIControlState.Normal,
UIBarMetrics.Default);
UIBarButtonItem.Appearance.SetBackButtonBackgroundImage(
Resources.BarButtonBackNormal.CreateResizableImage(new UIEdgeInsets(0,15,0,5)),
UIControlState.Normal,
UIBarMetrics.Default);
//Only if the UIBarButtonItem is in a UISearchBar
UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetBackgroundImage (
Resources.BarButtonCancelNormal.CreateResizableImage(new UIEdgeInsets(5,5,5,5)),
UIControlState.Normal,
UIBarMetrics.Default);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment