vahidgr
vahidgr

Reputation: 83

Detect UIPageViewController begin swipe

I have a UIPageViewController inside a ViewController which contains a UICollectionView to indicate which page is on, and on didSelectItemAt it sets the child VC to be shown.

I need to disable interactions on UICollectionView while the page view is being touched so there will be no interruptions with the way I handle page selection.

I have tried adding a UISwipeGestureRecognizer and using this method below:

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

I haven't found a way to do so up to this point. Any suggestions?

Upvotes: 0

Views: 379

Answers (1)

matt
matt

Reputation: 534950

Use the delegate.

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

It tells you when the gesture starts and when it ends.

Upvotes: 1

Related Questions