ios - 确定 UIPageViewController 何时滚动到最后一页

标签 ios swift uipageviewcontroller

我正试图关闭一个 UIPageViewController,它在用户滚动到最后一页时以模态方式呈现。有没有办法判断这种情况何时发生? 显示最后一个 View Controller 时调用 viewControllerAfterViewController。

编辑:我也尝试添加 UISwipeGestureRecognizers,但没有调用它们。我认为这是因为 UIPageViewController 的手势识别器禁用了它们。

最佳答案

UIViewController:viewWillAppear:animated 将在用户滑动到该页面时被调用。因此,您可以添加一个虚拟的最后一页,并在调用时关闭 pageViewController。

关于ios - 确定 UIPageViewController 何时滚动到最后一页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33181685/

相关文章:

ios - AEXMLDocument loadXMLData() 在 Swift 中不起作用

ios - IBAgent NSInternalInconsistencyException : Failed to create work interval 后无法在 Xcode 12 中编辑 Storyboard

ios - 线程 1 : EXC_BREAKPOINT (code=1, subcode=...) 使用 MKMap View 时

objective-c - 异步闭包在 Swift 中是如何工作的

ios - 在 UIPageViewController 内的 ViewController 内的 ScrollView 中检测 ScrollOffset?

ios - 未调用 audioRecorderBeginInterruption

ios - 暂停菜单图层

ios - prepareForSegue 不会在 Swift 4 中传递数据

swift - 在 UIPageViewController 中拖动项目

ios - 如何在 View Controller 之间同步索引