UIScreenEdgePanGestureRecognizer to activate pan gestures SWRevealViewController

I am using SWRevealViewController for the sidebars and I have to use swipes for my previous and subsequent stories and edges for the sidebars.

The reason I am using UIScreenEdgePanGestureRecognizer instead of PanGestureRecogniser is because the swipe will end with a call gesture, which makes the whole page clutter. I hope there is a way to trigger the gesture gesture when the pan marker is activated, instead:

[self.view addGestureRecognizer:[MainViewController sharedInstance].revealViewController.panGestureRecognizer];


[[BTHomeViewController sharedInstance].revealViewController.panGestureRecognizer requireGestureRecognizerToFail: left];
[[BTHomeViewController sharedInstance].revealViewController.panGestureRecognizer requireGestureRecognizerToFail: right];

      

I want to use a delegate from SWRevealVC. If there is another way, please suggest it to me.

UIScreenEdgePanGestureRecognizer *panLeft = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(_handleRevealGesture:)];
[panLeft setEdges:UIRectEdgeLeft];
panLeft.minimumNumberOfTouches = 1;
panLeft.maximumNumberOfTouches = 1;
[self.view addGestureRecognizer:panLeft];

      

Delegate SWRevealVC methods

// The following methods provide a means to track the evolution of the gesture recognizer.
// The 'location' parameter is the X origin coordinate of the front view as the user drags it
// The 'progress' parameter is a positive value from 0 to 1 indicating the front view location relative to the
// rearRevealWidth or rightRevealWidth. 1 is fully revealed, dragging ocurring in the overDraw region will result in values above 1.
- (void)revealController:(SWRevealViewController *)revealController panGestureBeganFromLocation:(CGFloat)location progress:(CGFloat)progress;
- (void)revealController:(SWRevealViewController *)revealController panGestureMovedToLocation:(CGFloat)location progress:(CGFloat)progress;
- (void)revealController:(SWRevealViewController *)revealController panGestureEndedToLocation:(CGFloat)location progress:(CGFloat)progress;

      

+3


source to share


1 answer


To replace UIPanGestureRecognizer with UIScreenEdgePanGestureRecognizer, simply do the following:



  • Go to SWRevealViewController
  • Find and replace UIPanGestureRecognizer with UIScreenEdgePanGestureRecognizer
  • Most IMPORTANT given ribs

    _panGestureRecognizer.edges = UIRectEdgeLeft;

+4


source







All Articles