簡體   English   中英

Xamarin iOS - 屏幕流程

[英]Xamarin iOS - Screen Flow

我在 UIViewControllers 周圍的應用程序中有導航流選項

A->B->C

A->D

在 C 中,有一個選項允許用戶 D。

I've tried from C present D and dismissing C but it brings me back to B. In android, i would normally do two popbackstack and show D. How can I do it in Xamarin iOS?

如果您使用從PushViewController到 D 的 PushViewController,您可以通過NavigationController.PopToRootViewController(true);

如果使用PresentViewController到 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);

    };

在這里上傳了我的樣本,你可以檢查一下。 隨時問我任何問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM