Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPageViewController and UIScrollView

I have a view controller that it part of a UIPageViewController. Within this view controller, there is a view called pdfView. This view has a UIScrollview.

-UIPageViewController
   -UIViewController
        -pdfView (UIView)
            -UIScrollView

I set the gesture recognizers of pdfView to be the UIPageViewController's gesture recognizers (for turning the page). The only problem is, if the user zooms into the scroll view by pinching, they are unable to move to the right or left of the scroll view because the page turns instead. What do you suggest I do to prevent this from happening? Thanks.

pdfView.gestureRecognizers = self.pageViewController.gestureRecognizers;
like image 267
Jack Humphries Avatar asked Sep 26 '26 18:09

Jack Humphries


1 Answers

Try this, instead using a scrollview use a regural UIView Add to this new UIView an UIPinchGestureRecognizer to zoom it and an UIPanGestureRecognizer to move the content. (you have to create the pinch and pan actions, but you can google them)

I did something similar and worked, the only problem is sometimes it detect the page swipe instead the view pan, you can solve is forcing the pan to require 2 touches.

If you have doubts let me know

like image 123
jcesarmobile Avatar answered Sep 29 '26 10:09

jcesarmobile