diff --git a/SlideMenu/Source/SlideNavigationController.h b/SlideMenu/Source/SlideNavigationController.h index ab1a95d..2cceeca 100644 --- a/SlideMenu/Source/SlideNavigationController.h +++ b/SlideMenu/Source/SlideNavigationController.h @@ -51,6 +51,7 @@ typedef enum{ @property (nonatomic, strong) UIBarButtonItem *rightBarButtonItem; @property (nonatomic, assign) CGFloat portraitSlideOffset; @property (nonatomic, assign) CGFloat landscapeSlideOffset; +@property (nonatomic, assign) CGFloat panGestureSideOffset; @property (nonatomic, strong) id menuRevealAnimator; + (SlideNavigationController *)sharedInstance; diff --git a/SlideMenu/Source/SlideNavigationController.m b/SlideMenu/Source/SlideNavigationController.m index c62ec14..d08aae0 100644 --- a/SlideMenu/Source/SlideNavigationController.m +++ b/SlideMenu/Source/SlideNavigationController.m @@ -33,7 +33,7 @@ typedef enum { PopTypeRoot } PopType; -@interface SlideNavigationController() +@interface SlideNavigationController() @property (nonatomic, strong) UITapGestureRecognizer *tapRecognizer; @property (nonatomic, strong) UIPanGestureRecognizer *panRecognizer; @property (nonatomic, assign) CGPoint draggingPoint; @@ -104,6 +104,7 @@ static SlideNavigationController *singletonInstance; self.landscapeSlideOffset = MENU_DEFAULT_SLIDE_OFFSET; self.portraitSlideOffset = MENU_DEFAULT_SLIDE_OFFSET; + self.panGestureSideOffset = 0; self.avoidSwitchingToSameClassViewController = YES; self.enableShadow = YES; self.enableSwipeGesture = YES; @@ -638,6 +639,19 @@ static SlideNavigationController *singletonInstance; [self closeMenuWithCompletion:nil]; } +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch +{ + if (self.panGestureSideOffset == 0) + return YES; + + CGPoint pointInView = [touch locationInView:self.view]; + CGFloat horizontalSize = [self horizontalSize]; + + return (pointInView.x <= self.panGestureSideOffset || pointInView.x >= horizontalSize - self.panGestureSideOffset) + ? YES + : NO; +} + - (void)panDetected:(UIPanGestureRecognizer *)aPanRecognizer { CGPoint translation = [aPanRecognizer translationInView:aPanRecognizer.view]; @@ -761,6 +775,7 @@ static SlideNavigationController *singletonInstance; if (!_panRecognizer) { _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panDetected:)]; + _panRecognizer.delegate = self; } return _panRecognizer;