|
33 | 33 | PopTypeRoot |
34 | 34 | } PopType; |
35 | 35 |
|
36 | | -@interface SlideNavigationController() |
| 36 | +@interface SlideNavigationController() <UIGestureRecognizerDelegate> |
37 | 37 | @property (nonatomic, strong) UITapGestureRecognizer *tapRecognizer; |
38 | 38 | @property (nonatomic, strong) UIPanGestureRecognizer *panRecognizer; |
39 | 39 | @property (nonatomic, assign) CGPoint draggingPoint; |
@@ -104,6 +104,7 @@ - (void)setup |
104 | 104 |
|
105 | 105 | self.landscapeSlideOffset = MENU_DEFAULT_SLIDE_OFFSET; |
106 | 106 | self.portraitSlideOffset = MENU_DEFAULT_SLIDE_OFFSET; |
| 107 | + self.panGestureSideOffset = 0; |
107 | 108 | self.avoidSwitchingToSameClassViewController = YES; |
108 | 109 | self.enableShadow = YES; |
109 | 110 | self.enableSwipeGesture = YES; |
@@ -638,6 +639,19 @@ - (void)tapDetected:(UITapGestureRecognizer *)tapRecognizer |
638 | 639 | [self closeMenuWithCompletion:nil]; |
639 | 640 | } |
640 | 641 |
|
| 642 | +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch |
| 643 | +{ |
| 644 | + if (self.panGestureSideOffset == 0) |
| 645 | + return YES; |
| 646 | + |
| 647 | + CGPoint pointInView = [touch locationInView:self.view]; |
| 648 | + CGFloat horizontalSize = [self horizontalSize]; |
| 649 | + |
| 650 | + return (pointInView.x <= self.panGestureSideOffset || pointInView.x >= horizontalSize - self.panGestureSideOffset) |
| 651 | + ? YES |
| 652 | + : NO; |
| 653 | +} |
| 654 | + |
641 | 655 | - (void)panDetected:(UIPanGestureRecognizer *)aPanRecognizer |
642 | 656 | { |
643 | 657 | CGPoint translation = [aPanRecognizer translationInView:aPanRecognizer.view]; |
@@ -761,6 +775,7 @@ - (UIPanGestureRecognizer *)panRecognizer |
761 | 775 | if (!_panRecognizer) |
762 | 776 | { |
763 | 777 | _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panDetected:)]; |
| 778 | + _panRecognizer.delegate = self; |
764 | 779 | } |
765 | 780 |
|
766 | 781 | return _panRecognizer; |
|
0 commit comments