Skip to content

Instantly share code, notes, and snippets.

@alexeckermann
Created August 19, 2011 05:48
Show Gist options
  • Save alexeckermann/1156141 to your computer and use it in GitHub Desktop.
Save alexeckermann/1156141 to your computer and use it in GitHub Desktop.
How to access the previous UIViewController from a pushed UIViewController your about to close
- (void)closeThisViewController {
// Lets retain an instance of the current navigation controller
UINavigationController *navController = [self.navigationController retain];
// When this is called self.navigationController is no longer available
[self.navigationController popViewControllerAnimated: YES];
// To talk to that previous VC here's what you do
[[navController topViewController] doSomethingHere:YES];
// We retained it, lets release it!
[navController release];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment