The UIPageViewController with the PageCurl transition is great for simulate pages, but the default GestureRecognizer (UIPanGestureRecognizer) is only responding to one finger events. I want to add a two finger event above the others.
How to add another PanGestureRecognizer to the current UIPageViewController instance? This new PanGestureRecognizer should wait for two fingers pan touches, without disabling the original UIPanGestureRecognizer.
All I need is a way to rise an additional custom event if the user scroll the pages with two fingers instead of one, but it should still scroll the pages like the one finger event was called.
How can I do this in MonoTouch?
Thanks in advance.
I solved the issue myself. The UIPageViewController contains an array of gesture recognizers. The first one is the one we need to get, changing its "MaximumNumberOfTouches" property from 1 to 2. Here is the code:
UIPageViewController pageController = new UIPageViewController (UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min); UIPanGestureRecognizer pan_gesture_recognizer = (UIPanGestureRecognizer) pageController.GestureRecognizers; pan_gesture_recognizer.MaximumNumberOfTouches = 2;
Then, inside your code handling the page turn event (in my case a custom class inheriting the "UIPageViewControllerDataSource") you can access the current number of touches with:
int number_of_touches = pageController.GestureRecognizers .NumberOfTouches;
and use this value to act accordingly.