gpt4 book ai didi

ios - UIPageViewController 具有未知数量的 UIViewController 实例

转载 作者:行者123 更新时间:2023-11-28 13:58:14 24 4
gpt4 key购买 nike

我想创建一个 UIPageViewController,它只使用一个 UIViewController,但它的每个新实例每次都会保存不同的数据。 UIPageViewController 需要在每次 [previous][current][ 时持有 3 个 UIViewController 实例next] 并随时加载下一个或上一个。重要的是要说明我不使用 Storyboard。

我找到了 this链接,但我不知道该怎么做,因为在 setupPageController() 上,他正在使用他之前创建的 UIViewControllers 初始化 UIPageViewController( pageViewController.setViewControllers)

这样做的正确和最佳方法是什么?

最佳答案

The UIPageViewController needs to hold 3 instances

不,不是。页面 View Controller 没有固定的页面集;它只有一页。您无需提前计划来提前创建任何其他页面。这就是重点。当您收到用户想要下一页或上一页的通知时,您可以立即决定它是什么并创建它。您可以使用任何您喜欢的逻辑。

关于ios - UIPageViewController 具有未知数量的 UIViewController 实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53749661/

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