2

I want to use MMDrawerController in my project.My home page has a Scrollview and two tableview in scrollview.So left slide and right slide MMDrawerController not work.please help me .I saw [self.drawerController.centerViewController myCustomSubview] is solve this problem?I don't know myCustomSubview what this is?

Kousik
  • 21,485
  • 7
  • 36
  • 59
chivaszhu
  • 31
  • 3

1 Answers1

0

UIGestureRecognizerDelegate provides methods for managing gesture conflicts, and UIScrollView exposes the gestures that are used so you can provide more fine grained control.

If you combine those with setGestureShouldRecognizeTouchBlock on drawerController, you should be able to manage the conflict.

Anyway this can't only be achieved with the setGestureShouldRecognizeTouchBlock. You can achieve it using shouldRequireFailureOfGestureRecognizer to actually disable the scrollview gesture.

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
    if (gestureRecognizer != self.panGesture || self.openSide != MMDrawerSideNone) {
        return NO;
    }
    CGPoint velocity = [self.panGesture velocityInView:self.panGesture.view];
    BOOL isHorizontalGesture = fabs(velocity.y) <= fabs(velocity.x);

    if(isHorizontalGesture) {
        CGPoint point = [gestureRecognizer locationInView:gestureRecognizer.view];
    if(([self isPointContainedWithinLeftBezelRect:point] && self.leftDrawerViewController) ||
       ([self isPointContainedWithinRightBezelRect:point] && self.rightDrawerViewController)){
            otherGestureRecognizer.enabled = NO;
            otherGestureRecognizer.enabled = YES;
            return YES;
        }
    }
    return NO;
}
Kousik
  • 21,485
  • 7
  • 36
  • 59