0
votes

I want a user to normally be able to swipe right to left through the pages of the page view controller, but I also want the user to swipe up on a page to save the content of that page. So far I have tried adding a gesture recogniser but it interferes with the page view controller. I have tried many thins like adding the gesture recogniser to the window, or a hidden view but it keeps messing with the page view controller.

All in all is there a way that mainly horizontal swipes get picked up by the page view controller(so they move to the next viewcontroller), but vertical swipes are picked by by me and I can play an animation and trigger a function or something...

1
Put your "page content" in a scroll view with .alwaysBounceVertical = true. - DonMag
man this is so genius thanks a lot, I just implemented it and it works perfectly, thanks again. - coderodur

1 Answers

0
votes

It looks like UIPageViewController exposes its gesture recognizers with the property gestureRecognizers.

You should be able to attach your swipe up gesture recognizer to the page's view.

You'd then tell your gesture recognizer that it should only work when the page view controler's gesture recognizers fail. You'd call your gesture recognizer's require(toFail:) method for each of the page view controller's gesture recognizers.

(You should read the Xcode documentation on UIGestureRecognizer. It explains how you can set up dependencies between gesture recognizers so that one has to fail before the next one will evaluate, for situations like this one.)