0

I pretty new to Xamarin.iOS and I need some help on the navigation.

To make it short, here is how the navigation should work in my application:

My application consists of 3 screens.

Screen 1 : This is a simple UITableViewController where I can add items to the list. When I add an item I have a segue (show details) to screen 2.

Screen 2 & 3: Screen 2 is embedded in a UINavigationController. Screen 3 is the end of my wizzard to add an item.

On screen 3 when I'm done, I have a button to navigate back to Screen 1. How do I navigate from there and remove from the stack the UINavigationController, Screen 2 & 3?

2 Answers 2

0

use the PopToRootViewController() method on UINavigationController

nav.PopToRootViewController(true);
1
  • Thanks Jason, actually, what I was looking for is an unwind segue
    – JuChom
    Apr 13, 2016 at 11:10
0

From Xamarin docs: Creating an Unwind Segue

An unwind Segue can be used to navigate back through a push or modal segue - for example by dismissing the modally presented view controller. In addition to this, you can unwind through not only one, but a series of push and modal segues and go back multiple steps in your navigation heirarchy with a single unwind action.

You just need this piece of code in the target UIViewController

[Action ("UnwindToTargetViewController:")]
public void UnwindToTargetViewController (UIStoryboardSegue segue)
{
    Console.WriteLine ("We've unwinded to Target!");
}

On the OriginViewController, just link a button with the exit scene and select the method you just created!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.