我怎么知道UIPageViewController是向前翻转还是倒转?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (187)

我有一个UIPageViewController,我不知道如何转向页面的方向,这样就可以适当地设置页面计数。

提问于
用户回答回答于

可以尝试如下代码:

- (void)pageViewController:(UIPageViewController *)pvc didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed
{
    // If the page did not turn
    if (!completed)
    {
        // You do nothing because whatever page you thought 
        // the book was on before the gesture started is still the correct page
        return;
    }

    // This is where you would know the page number changed and handle it appropriately
    // [self sendPageChangeNotification:YES];
}
用户回答回答于

当用户翻页时,UIPageViewController的setViewControllers:方法将被调用。此

扫码关注云+社区

领取腾讯云代金券