2

I have a app in which I have a PageViewController that shows it's pages on after another without the user doing anything. I want to totally block the user's acces. I have a back button that appears on the top after all of pages have been shown. But if I try to tap it ... it starts going through the pages again (it's in the area that you would usually tap to go to previous page).

So, does anyone have any idea how could I "remove" the gesture recognizers ?

I tried commenting the line :

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

from RootViewController but it didn't work.

Toncean Cosmin
  • 535
  • 4
  • 19

1 Answers1

4

I haven't tried this myself, and it probably won't be the solution for everyone, but for your particular case because you're manually changing all the pages it should work. I found the following tid-bit in the UIPageViewController documentation in the Overview section.

"Gesture-based navigation is enabled only when a data source is provided."

You will still want to comment out the line that you mentioned above, but also self.pageViewController.dataSource = self.modelController;

EDIT: Just tested this myself and it works. Can't navigate with any of the gestures, but can programmatically.

DonnaLea
  • 8,643
  • 4
  • 32
  • 32
  • Since answering this question I've also found there are other more flexible solutions which may be of benefit: http://stackoverflow.com/questions/7788780/uipageviewcontroller-gesture-recognizers The highest voted answer by jramer is good, but so is Pat McG's. – DonnaLea Jun 27 '12 at 06:32