Skip to content

Instantly share code, notes, and snippets.

@jweinberg
Created November 3, 2011 21:09
Show Gist options
  • Save jweinberg/1337789 to your computer and use it in GitHub Desktop.
Save jweinberg/1337789 to your computer and use it in GitHub Desktop.
@implementation JWNavigationController
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
{
if (viewController.navigationItem.leftBarButtonItem == nil)
{
JKBackBarButtonItem *backItem = [[JWBackBarButtonItem alloc] initWithTitle:self.topViewController.navigationItem.title ?: @"Back"
target:self
action:@selector(doPop:)];
viewController.navigationItem.leftBarButtonItem = backItem;
}
[super pushViewController:viewController animated:animated];
}
- (void)doPop:(id)sender;
{
[self popViewControllerAnimated:YES];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment