【问题标题】:Detect UIPageViewController begin swipe检测 UIPageViewController 开始滑动
【发布时间】:2020-09-10 07:27:53
【问题描述】:

我在ViewController 中有一个UIPageViewController,其中包含一个UICollectionView 以指示打开的页面,在didSelectItemAt 上它设置要显示的子VC。

我需要在触摸页面视图时禁用UICollectionView 上的交互,这样我处理页面选择的方式就不会中断。

我已尝试添加UISwipeGestureRecognizer 并使用以下方法:

override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) {
    _delegate?.stopTouches()
}

到目前为止,我还没有找到这样做的方法。 有什么建议吗?

【问题讨论】:

    标签: ios swift uipageviewcontroller


    【解决方案1】:

    使用委托。

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

    它会告诉您手势何时开始以及何时结束。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-21
      相关资源
      最近更新 更多