Created
September 17, 2015 13:23
-
-
Save iosappdeveloper/2e0978fed6f1da35861a to your computer and use it in GitHub Desktop.
UINavigationController "Back" button - custom handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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