views:

40

answers:

2

I am using a UINavigationController to slide from a UITableViewController to another view. In that second view I have created a custom "Back" button which is attached to an action.

What code do I use to return to dismiss the current view and slide back to my first view? I need something that is the equivalent to [super dismissModalViewControllerAnimated:true]; but obviously this is not a modal view.

Thanks.

+2  A: 

Look at one of the following three methods on your navigation controller:

popViewControllerAnimated:
popToRootViewControllerAnimated:
popToViewController:animated:

Depending on how you want to handle it of course. Generally one just uses the first method to go back to the last view (the one that pushed your current view onto the navigation stack).

jer
Thank you, this really helped!
Nic Hubbard
no problem, glad i could help
jer
+1  A: 

Use popToRootViewControllerAnimated method in UINavigationController:

[self.navigationController popToRootViewControllerAnimated:animated];
Vladimir