Skip to content

Instantly share code, notes, and snippets.

@fcaldarelli
Last active October 18, 2016 13:01
Show Gist options
  • Save fcaldarelli/03bcef14e759023c955e65031845a35e to your computer and use it in GitHub Desktop.
Save fcaldarelli/03bcef14e759023c955e65031845a35e to your computer and use it in GitHub Desktop.
Navigation bar customized back button
@implementation BaseViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
if([self isNavBarBackButtonCustomized])
{
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(onNavBarBackButtonTapped:)];
self.navigationItem.leftBarButtonItem = backButton;
}
}
#pragma mark NavBar Customization
- (BOOL)isNavBarBackButtonCustomized
{
return YES;
}
- (void)onNavBarBackButtonTapped:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment