Conflict with Pagecontrol conflicts with swrevealcontroller?

I added swrevealcontroller to my application. When you click an item in the table, a new view controller opens. I added pageControl to this controller. The first time the hard arrow of the pagecontrol works, but the next time the hard arrow does not work to control the page. Please tell me how I can avoid clashing pan gestures.

- (void)_handleRevealGesture:(UIPanGestureRecognizer *)recognizer { NSLog(@"handle pan gesture"); CGPoint velocity = [recognizer velocityInView:self.view]; if(velocity.x > 0) { NSLog(@"gesture went right"); } else { NSLog(@"gesture went left"); if(self.isReaveled) { switch ( recognizer.state ) { case UIGestureRecognizerStateBegan: [self _handleRevealGestureStateBeganWithRecognizer:recognizer]; break; case UIGestureRecognizerStateChanged: [self _handleRevealGestureStateChangedWithRecognizer:recognizer]; break; case UIGestureRecognizerStateEnded: [self _handleRevealGestureStateEndedWithRecognizer:recognizer]; break; case UIGestureRecognizerStateCancelled: //case UIGestureRecognizerStateFailed: [self _handleRevealGestureStateCancelledWithRecognizer:recognizer]; break; default: break; } } } } 

I modified the above code to work, but it does not work.

+6
source share
1 answer

you first set delegate pan gestures to the swrevealcontroller in the view controller where you use the pagecontroller. for this also add a delegate gesturerecogniser.

how to implement this delegate method of GestureRecongnizer.

 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { if (otherGestureRecognizer.delegate == self) return NO; if ([[otherGestureRecognizer.view class] isSubclassOfClass:[UIPageViewController class]]) { NSLog(@"Allow1 %@", [otherGestureRecognizer description]); return YES; } NSLog(@"Deny %@", [otherGestureRecognizer description]); return NO; } 

Hope this helps you.

0
source

All Articles