ios - UIPageViewController 中的离屏页面限制

标签 ios swift uipageviewcontroller

我想在开始时加载 UIPageViewController 中的所有页面。在 Android 中使用 View 寻呼机的 setOffScreenPageLimit 方法很容易。是否有可能 swift 实现这一目标?

最佳答案

是也不是。您可以一次手动将一个或两个 Controller 传递给您的 UIPageViewController 或实现 UIPageViewControllerDataSource 以在需要时调用和获取 Controller 。

When defining a page view controller interface, you can provide the content view controllers one at a time (or two at a time, depending upon the spine position and double-sided state) or as-needed using a data source. When providing content view controllers one at a time, you use the setViewControllers(_:direction:animated:completion:) method to set the current content view controllers. To support gesture-based navigation, you must provide your view controllers using a data source object. The data source for a page view controller is responsible for providing the content view controllers on demand and must conform to the UIPageViewControllerDataSource protocol. The delegate object—an object that conforms to the UIPageViewControllerDelegate protocol—provides some appearance-related information and receives notifications about gesture-initiated transitions. This class is generally used as-is, but can also be subclassed.

https://developer.apple.com/documentation/uikit/uipageviewcontroller

关于ios - UIPageViewController 中的离屏页面限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46670280/

相关文章:

swift - 如何检查 Sprite Node 是否接触到另一个 Sprite Note?

ios - 在 UIPageViewController 中嵌入 UIScrollView 并禁用 pageView 滑动?

ios - 使用新文本重新加载 TextView 时清除内存 - iOS Swift

swift - 在 Swift 自定义动画中正确处理/清理 CADisplayLink 等?

ios - 如何快速按下按钮以在Xcode上产生声音?

iphone - RTL语言uipageviewcontroller动画

ios - 如何修复 UIPageViewController 页面中突出显示状态的 UIButton 延迟?

ios - Firebase 集成到 IOS 项目 - 没有这样的文件或目录

ios - Core Graphics - 有没有办法从 CGContext 获取/检索当前设置的 CGColor?

iOS计时器/工资计算器