1

Does anyone have an example for NavigationController.PopToViewContoller(); using MonoTouch/Xamarin?

Framester
  • 33,341
  • 51
  • 130
  • 192
user763129
  • 11
  • 2
  • It's pretty straightforward - just call the method, and pass a reference to a view controller that is already in your navigation stack. – Jason May 20 '11 at 19:07

3 Answers3

5

To go back to the last ViewController:

this.NavigationController.PopViewControllerAnimated(true);

To go to the Root View Controller

this.NavigationController.PopToRootViewController(true);

To go to a new viewController do this:

this.NavigationController.PopToViewController( MyNewViewController, true);
nytrm
  • 509
  • 1
  • 5
  • 15
0

First the view controller you want to pop to, needs to be in the navigation stack, so you must have pushed to it at some point previously in navigation.

Pavel Sich
  • 1,299
  • 10
  • 10
0

[self.navigationController popViewControllerAnimated:YES];

Yasir Kamal
  • 443
  • 4
  • 10