gpt4 book ai didi

swift - 如何从 UIPageViewController 打开 View 并返回到 UIPageViewController

转载 作者:行者123 更新时间:2023-11-28 14:44:29 26 4
gpt4 key购买 nike

我在从 UIPageViewController 打开 View 并返回到 PageViewController 上的同一页面时遇到问题。我当前的设置是一个教程,您可以滚动页面查看教程。在第二页上,它要求用户从另一页上的 TableView 中选择项目(通过单击按钮)。然后我将如何返回到 UIPageViewController 的第二页?

最佳答案

你可以这样使用:controller.setViewControllers([self.pages[page]], direction: .forward, animated: false, completion: nil)

方向和动画由您决定。

您可以通过在页面中使用 presentViewController:animated:completion: 来显示页面中的第二个 vc。设置一些委托(delegate)以在父 Controller 和呈现的 Controller 之间传递数据。

选择后,您只需 dismissViewControllerAnimated:completion: 即可回到之前的位置。

关于swift - 如何从 UIPageViewController 打开 View 并返回到 UIPageViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50370803/

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