[英]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.