Reputation: 3079
I m making an app which has a main TableView. when we click any cell we got DetailView of that cell. we can also change DetailView without going back to main TableView by using next and prev button on every DetailView. When i click prev button. I get previous item'd DetailView but animation is like its going forward. i m using this:
[self.navigationController pushViewController:prevView animated:YES];
can anybody tell me how can i change that animation like Back button animation.
Thanx in advance
Upvotes: 1
Views: 352
Reputation: 1963
You have to store your navigationController, then 'pop' your current view with an animation and 'push' the detail view without an animation, for example like Squeegy did here. I've adjusted Squeegy's code a bit, the following should work:
// locally store the navigation controller since
// self.navigationController will be nil once we are popped
UINavigationController *navController = self.navigationController;
// retain ourselves so that the controller will still exist once it's popped off
[[self retain] autorelease];
// Pop this controller and replace with another
[navController popViewControllerAnimated:YES];
[navController pushViewController:prevView animated:NO];
Upvotes: 1