RESideMenu icon indicating copy to clipboard operation
RESideMenu copied to clipboard

Disable pan gesture from one side.

Open dslamowitz opened this issue 10 years ago • 3 comments

I'd like to disable the swipe feature from one side to block the user from swiping from the left. Is there a way to disable the pan gesture from only one side instead of disabling the entire sidemenu? Right now I'm using [self.sideMenuViewController setPanGestureEnabled:NO]; but it blocks access to the right menu. thanks

dslamowitz avatar Jun 11 '14 19:06 dslamowitz

I am also looking to solve the same issue as dslamowitz.

porterNicholas avatar Jun 16 '14 00:06 porterNicholas

i got the answer... please use the below method then it work properly....

  • (void)sideMenu:(RESideMenu *)sideMenu didRecognizePanGesture:(UIPanGestureRecognizer *)recognizer{

CGPoint vel = [rec velocityInView:self.view]; if (vel.x > 0) { // user dragged towards the right } else { // user dragged towards the left

}

}

if you want to diesable right then remove code from below method

  • (void)panGestureRecognized:(UIPanGestureRecognizer *)recognizer;

and add in

  • (void)sideMenu:(RESideMenu *)sideMenu didRecognizePanGesture:(UIPanGestureRecognizer *)recognizer;

vvkaghera avatar Aug 24 '15 09:08 vvkaghera

you can also subclass RESideMenu and add this to disable one side

`override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    if self.view.subviews.last?.frame.origin.x ?? 0 < 0 {
        self.view.subviews.last?.frame.origin.x = 0
    }
}'

granted there should be a better way to disable this ( allowing for nil viewcontrollers ideally )

Gastonison avatar Aug 25 '17 19:08 Gastonison