Assuming by your use of “push
” you mean that you are using a UINavigationController
, then you can use the following to return to the top of the stack.
[self.navigationController popToRootViewControllerAnimated:YES];
or
UIViewController *prevVC = [self.navigationController.viewControllers objectAtIndex:<n>];
[self.navigationController popToViewController:prevVC animated:YES];
to pop to a specific level where <n>
is the level.
or
[self.navigationController popViewControllerAnimated:YES];
If you just want to pop one level back up the navigation stack.