gpt4 book ai didi

iOS 快速展开 2 个 View Controller 并显示另一个

转载 作者:行者123 更新时间:2023-11-28 07:54:56 25 4
gpt4 key购买 nike

我有 4 个 View Controller (A、B、C、D)。我可以从 A -> B,B -> C。在 View Controller C 中,我想做的是,删除 B 和 C,然后显示 View Controller D。这样,如果我从 D 返回,它会转到 A。

我想通过平稳过渡来执行此操作。 D 已经实现了 UIViewControllerTransitioningDelegate 方法。所以在 C 中,我应该能够删除自身,然后 B 可以像什么都没发生一样用 D 的 Transition 显示 D。我没有使用 NavigationController。我可以使用哪些方法来做到这一点?

我正在使用 Xcode 9 和 Swift 4谢谢

最佳答案

假设所有的 viewControllers 都在同一个 UINavigationController 下,为什么不尝试使用 navigationController 的 setViewControllers:animated: 方法并将数组设置为 [viewControllerA],

popToViewController:animated:并传入viewController A,

或者假设 VC A 是根 VC,使用 popToRootViewControllerAnimated:弹出到根。

希望对你有帮助

关于iOS 快速展开 2 个 View Controller 并显示另一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48504944/

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