gpt4 book ai didi

iphone - 单点触控 : PopToViewController and then pushing one causes views clashing on iPod/iPhone

转载 作者:行者123 更新时间:2023-11-29 13:23:10 24 4
gpt4 key购买 nike

我需要一次弹出 3 个 Controller ,所以我使用导航 Controller 中的 PopToViewController 方法,然后将一个新 Controller 插入其中。它导致 View 重叠。两个 Controller ,它被弹出的和被推送的都是 DialogViewControllers。除了这种情况只发生在 iPod/iPhone 上,在 iPad 上它工作正常。

代码很简单:

NavigationController.PopToViewController(NavigationController.ViewControllers[NavigationController.ViewControllers.Count() - 1 - numberOfViews], animated);
NavigationController.PushViewController(viewController);

有什么帮助吗?

最佳答案

与其同时出栈和入栈,不如替换栈

UIViewControllers[] newStack = new UIViewController[NavigationController.ViewControllers.Count()-numberOfViews+1];
for (int i = 0; i < NavigationController.ViewControllers.Count()-numberOfViews; i++)
{
newStack[i] = NavigationController.ViewControllers[i];
}
newStack[NavigationController.ViewControllers.Count()-numberOfViews] = viewController;
NavigationController.SetViewControllers(newStack, true);

关于iphone - 单点触控 : PopToViewController and then pushing one causes views clashing on iPod/iPhone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13849310/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com