Skip to content

Instantly share code, notes, and snippets.

@iosappdeveloper
Created September 17, 2015 13:23
Show Gist options
  • Save iosappdeveloper/2e0978fed6f1da35861a to your computer and use it in GitHub Desktop.
Save iosappdeveloper/2e0978fed6f1da35861a to your computer and use it in GitHub Desktop.
UINavigationController "Back" button - custom handling
// Navigation BACK Button - custom
- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Backk" style:(UIBarButtonItemStylePlain) target:self action:@selector(back:)];
self.navigationItem.backBarButtonItem = backButtonItem;
self.navigationItem.hidesBackButton = NO;
}
- (void)back:(id)button {
if (self.webView.canGoBack) {
[self.webView goBack];
} else {
[self.navigationController popViewControllerAnimated:YES];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment