Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dreampowder/be6979df7c9ed0d7902bb8809ae19478 to your computer and use it in GitHub Desktop.
Save dreampowder/be6979df7c9ed0d7902bb8809ae19478 to your computer and use it in GitHub Desktop.
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
NSArray *viewControllers = self.navigationController.viewControllers;
if (viewControllers.count > 1 && [viewControllers objectAtIndex:viewControllers.count-2] == self) {
// View is disappearing because a new view controller was pushed onto the stack
NSLog(@"New view controller was pushed");
} else if ([viewControllers indexOfObject:self] == NSNotFound) {
// View is disappearing because it was popped from the stack
NSLog(@"View controller was popped");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment