Skip to content

Instantly share code, notes, and snippets.

@psobko
Created September 26, 2013 20:30
Show Gist options
  • Save psobko/6720079 to your computer and use it in GitHub Desktop.
Save psobko/6720079 to your computer and use it in GitHub Desktop.
Detect when back is tapped on navigation controller without subclassing
//http://stackoverflow.com/questions/12748911/do-things-when-back-button-is-pressed
-(void)viewWillDisappear:(BOOL)animated {
NSUInteger ind = [[self.navigationController viewControllers] indexOfObject:self];
if (ind == NSNotFound) {
// do something, we're coming off the stack.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment