6

I have added swrevealcontroller in my app.On click of item in table it opens a new view controller.I have added a pageControl in that view controller.So first time pan gesture of pagecontrol works but on next time pan gesture does not work for page control.Please tell me how can i avoid the confliction of pan gesture.

- (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 have modified the above code in order to work but it odes not work.

TechChain
  • 8,404
  • 29
  • 103
  • 228

1 Answers1

0

you have first set the delegate of swrevealcontroller's pan gesture in view controller where you use pagecontroller. for that also add the delegate of gesturerecogniser.

than 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 it will Help You.

JigneshP
  • 344
  • 2
  • 7