0

I'm trying to go back to the head of the navigation from a non-navigation view.

I tried passing the parent view controller from Nav2 to PayPalVC to MyViewController and using this following statement in MyViewController:

Note: The syntax is in C#

parent.NavigationController.PopToViewController(parent.NavigationController.ViewControllers[0], true);

This how it is set up:

RootViewController -> Head of Navigation -> Navigation 1 -> Navigation 2 -> PayPalViewController -> MyViewController -> Back to Head of Navigation

Nico
  • 12,493
  • 5
  • 42
  • 62
MartDavious
  • 131
  • 11

1 Answers1

1
MonoTouch.UIKit.UINavigationController.PopToRootViewController

as..

parent.NavigationController.PopToRootViewController(true);

not sure what parent is but may be redundant here

Parameters

animated: A boolean indicating if the transition back to the root controller should be animated.

Returns An array of view controller that were popped from the stack in the process of returning to the root controller.

Remarks After this call, the root controller will be at the top of the UINavigationController's stack, and the root controller's view will be displayed by the navigation controller.

https://developer.xamarin.com/api/member/MonoTouch.UIKit.UINavigationController.PopToRootViewController/p/System.Boolean/

Nico
  • 12,493
  • 5
  • 42
  • 62
  • parent is the view controller of Navigation 2's view controller. I passed that view controller to PayPalVC ann onto MyVC. I tried your suggestion and I got message on the console that reads: "Unbalanced calls to begin/end appearance transition for – MartDavious Apr 18 '16 at 03:35
  • Here is a post describing the issue, not sure if it helps. Could just try changing the `true` to `false` for the animation paramter. http://stackoverflow.com/questions/9088465/unbalanced-calls-to-begin-end-appearance-transitions-for-detailviewcontroller – Nico Apr 18 '16 at 03:40