Reputation: 13267
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;
Upvotes: 3
Views: 5430
Reputation: 7757
I made this library that makes this setup work
-UIPageViewController
-UIViewController
-UIView
-UIScrollView
-UIImageView
https://github.com/holyman2k/WXPagedPhotoView
the only issue i have is when user zoom the photo, the pageviewcontroller pan gesture is disabled till user scroll the edge and restart panning. you have this weird behaviour that user zoom in the photo, scroll to the very right hand, then scrolling stops, then user scroll again to move to the next page
Upvotes: 0
Reputation: 53301
I know my answer is the accepted, but I have tryed to change my UIView to a scrollView and all works better.
when I zoom a page, the pageview gestures of that page stop working, so I can zoom in and out, and pan the zoomed image withouth problem, and when I zoom to the initial scale, the page gestures start to work again automatically.
I have in my dataViewController the view, a full screen scrollerView, and a full screen imageView inside the scroller view.
-UIPageViewController
-UIViewController
-UIView
-UIScrollView
-UIImageView
So, if you want to change the page while it is zoomed, yo can, you have to choose between pan the zoomed page or change the page with the pan gesture. It was the behabiour I was looking for, in my code I do it manually, but I'm goin to change to the UIScrollView because the UIScrollView pan and pinch gestures work much better than mine.
Upvotes: 5
Reputation: 53301
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
Upvotes: 3