C# Xamarin iOS-屏幕流

C# Xamarin iOS-屏幕流,c#,ios,xamarin,uiviewcontroller,xamarin.ios,C#,Ios,Xamarin,Uiviewcontroller,Xamarin.ios,在我的UIViewController周围的应用程序中,我有这个导航流选项 A->B->C A->D 在C中,有一个选项允许用户连接到D。C和D之间不通过分段连接,但两者都来自A 我试过从C到D,然后驳回C,但这又把我带回了B。 在android中,我通常会做两次popbackstack和ShowD。 如何在Xamarin iOS中实现这一点?如果使用从C到D的PushViewController,则可以使用NavigationController.PoptrootViewController轻

在我的UIViewController周围的应用程序中,我有这个导航流选项

A->B->C

A->D

在C中,有一个选项允许用户连接到D。C和D之间不通过分段连接,但两者都来自A

我试过从C到D,然后驳回C,但这又把我带回了B。 在android中,我通常会做两次popbackstack和ShowD。
如何在Xamarin iOS中实现这一点?

如果使用从C到D的
PushViewController
,则可以使用
NavigationController.PoptrootViewController轻松返回A(true)

如果从C到D使用
PresentViewController
,则可以先显示D,然后在C中调用
PopToRootViewController

以下是C语言的代码:

    UIViewControllerD controlD =new UIViewControllerD();

    Action action = () => {
        NavigationController.PopToRootViewController(true);
    };

    myButton.TouchUpInside += (sender, e) => {

        //1. navigate to D
        //NavigationController.PushViewController(new UIViewControllerD(), true);

        //2. present D
        NavigationController.PresentViewController(controlD, true, action);
    };
返回时在D中输入代码:

    myButton.TouchUpInside += (sender, e) => {

        //1. navigate to root ViewControll
        //NavigationController.PopToRootViewController(true);

        //2. Dismiss D
        this.DismissViewController(true,null);

    };

我上传了我的样品,你可以查看。请随时问我任何问题。

您的问题解决了吗?