Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Solved following these steps:<br> 1- Declare a flag to indicate that the animation has finished or not:</p> <pre><code>BOOL pageAnimationFinished; </code></pre> <p>2- Set this flag to true in viewDidLoad:</p> <pre><code>pageAnimationFinished = YES; </code></pre> <p>3- Disable tapGesture for the pageViewController and assign 'self' to panGestureRecognizer delegate: </p> <pre><code>for (UIGestureRecognizer * gesRecog in self.pageViewController.gestureRecognizers) { if ([gesRecog isKindOfClass:[UITapGestureRecognizer class]]) gesRecog.enabled = NO; else if ([gesRecog isKindOfClass:[UIPanGestureRecognizer class]]) gesRecog.delegate = self; } </code></pre> <p>4- Allow/Disallow panGestureRecognizer through the following gesture recognizer delegate method:</p> <pre><code>-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] &amp;&amp; ([gestureRecognizer.view isEqual:self.view] || [gestureRecognizer.view isEqual:self.pageViewController.view])) { UIPanGestureRecognizer * panGes = (UIPanGestureRecognizer *)gestureRecognizer; if(!pageAnimationFinished || (currentPage &lt; minimumPage &amp;&amp; [panGes velocityInView:self.view].x &lt; 0) || (currentPage &gt; maximumPage &amp;&amp; [panGes velocityInView:self.view].x &gt; 0)) return NO; pageAnimationFinished = NO; } return YES; } </code></pre> <p>5- Add the following pageViewController delegate method:</p> <pre><code>- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed { pageAnimationFinished = YES; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload