我有一个Xamarin iOS应用程序,其中一个接一个地介绍几个模态。Modal1 -> Modal2 -> Modal3 -> etc.
我想控制和移动他们所有的框架。有什么方法可以访问我介绍的所有模态?
我尝试了类似的东西:
var rootView = UIApplication.SharedApplication.KeyWindow.RootViewController.PresentedViewController;
foreach (UIView v in rootView)
{
//some code
}
任何提示将不胜感激。谢谢!
最佳答案
尝试使用以下代码:
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
}
}
关于c# - 控制所有呈现的模态iOS,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52249269/