Reputation: 24949
When I click the table row, go back to previous view without clicking back button.
I try
[self.navigationController dismissModalViewControllerAnimated:YES];
it's not working. How to dismiss pushViewController ?
Upvotes: 0
Views: 546
Reputation: 926
With that line you are dismissing a modal view. That is not the same thing as popping controllers from the navigation controller stack.
You should instead do this:
[self.navigationController popViewControllerAnimated:YES];
This will pop the top controller.
Here is a link to the documentation.
Upvotes: 0
Reputation: 5088
dismissModalViewControllerAnimated is used to dismiss a Modal View Controller. These are the view controllers that slide up from the bottom of the screen. An example would be when you tap the button to compose a new email in the Mail app.
If you want the navigation controller to pop back to the previous view controller try using
[self.navigationController popViewControllerAnimated:YES];
Here's a link to the documentation for UINavigationController http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UINavigationController_Class/
Upvotes: 2