Reputation: 23
I've a problem that I move from first viewcontroller to third viewcontroller by pushviewcontroller but when i do popViewControllerAnimated it comes to second viewcontroller but I need to come to first. pls some one help me
Upvotes: 1
Views: 596
Reputation: 22726
You can use popToViewController as follows
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:o] animated:YES];
and similarly you can also use following statement to reach directly to first view controller where you started.
[self.navigationController popToRootViewControllerAnimated:YES];
Hope it helps.
Upvotes: 4