Bagusflyer
Bagusflyer

Reputation: 12915

Is there a way to implement a zoomable UIPageViewController in iOS 5?

There is a new View Controller in iOS 5: UIPageViewController which supports to turn page like iBook. But there is a problem to support zoom in/out page.

Then I add a scrollview to RootViewController's view. And add UIPageViewController's view as a subview of this scrollview. Then the zoom in/out works in both portrait and landscape mode. But another problem arise. After I zoom in the view, the page turning gesture doesn't work anymore. I think this may because of the conflict between scrollview's gesture and pageview's gesture.

I noticed that there is a statement like this:

self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;

So I change it to:

self.scrollView.gestureRecognizers = self.pageViewController.gestureRecognizers;

But it crashes, the error message is something like:

* -[UIScrollViewPanGestureRecognizer setMaximumNumberOfTouches:]: message sent to deallocated instance 0x6b80150

Any idea? Thanks

Upvotes: 2

Views: 1324

Answers (2)

dequin
dequin

Reputation: 926

You should do it backwards.

Put the scrollview(s) inside the pageviewcontroller and change the panning gesture on the scrollview to use more than one finger.

Upvotes: 1

steipete
steipete

Reputation: 7641

Nonono, setting the gestureRecognizers to another array is really bad. It's just exposed so you can tweak them, but don't replace the whole array.

If you disable bouncing then the page turn works most of the time.

Upvotes: 0

Related Questions