Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save benvium/5403718 to your computer and use it in GitHub Desktop.

Select an option

Save benvium/5403718 to your computer and use it in GitHub Desktop.
Code to put into a UIViewController to detect when (a) the BACK button is pressed or (b) the view is popped off the stack for whatever reason.
-(void)viewWillDisappear:(BOOL)animated {
NSUInteger ind = [[self.navigationController viewControllers] indexOfObject:self];
if (ind == NSNotFound) {
<#code to handle back#>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment