我想在开始时加载 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 theUIPageViewControllerDataSource
protocol. The delegate object—an object that conforms to theUIPageViewControllerDelegate
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/