Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save IronTony/5736320 to your computer and use it in GitHub Desktop.
Save IronTony/5736320 to your computer and use it in GitHub Desktop.
// This is assumed to be inside a UINavigationController
-(void)awakeFromNib
{
// How to turn a NavigationItem's rightBarButtonItem into an Info Button
// First, in your storyboard or xib add a Bar Button Item to the right slot in the navigation bar.
// Then, do this:
UIButton *infoLightButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
infoLightButton.frame = CGRectMake(0.0, 0.0, 25.0, 25.0);
infoLightButton.backgroundColor = [UIColor clearColor];
[infoLightButton addTarget:self action:@selector(showInfo:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *infoButton = [[UIBarButtonItem alloc] initWithCustomView:infoLightButton];
self.navigationItem.rightBarButtonItem = infoButton;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment