控制所有呈现的模式 iOS

我有一个 Xamarin iOS 应用程序,我在其中一个接一个地呈现几个模式。


Modal1 -> Modal2 -> Modal3 -> etc.


我想控制和移动他们所有的框架。有什么方法可以访问我展示的所有模式?


我试过类似的东西:


var rootView = UIApplication.SharedApplication.KeyWindow.RootViewController.PresentedViewController;

        foreach (UIView v in rootView)

        {

            //some code

        }

任何提示将不胜感激。谢谢!


人到中年有点甜
浏览 166回答 1
1回答

忽然笑

尝试使用以下代码:public void GetAllMoadlViewController ()    {        UIViewController presentViewController = this.PresentingViewController;        UIViewController lastVC = this;        while(presentViewController!=null)        {            // One by one to get all ModalViewController that you present             var temp = presentViewController;            presentViewController = presentViewController.PresentingViewController;            lastVC = temp;            //do some thing you want         }    } 
打开App,查看更多内容
随时随地看视频慕课网APP