Question

I'm using this source code for adding a sliding menu similar to the Facebook App:

Git Hub Project ECSlidingViewController: https://github.com/edgecase/ECSlidingViewController

Here is the code for my Custom UINavigation Controller:

@implementation NavViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    if (![self.slidingViewController.underLeftViewController isKindOfClass:[ZAPMenuViewController class]])
    {
        self.slidingViewController.underLeftViewController  = [self.storyboard instantiateViewControllerWithIdentifier:@"Menu"];
    }

    [self.view addGestureRecognizer:self.slidingViewController.panGesture];
}

However, I have a UITableView and I need to be able to swipe to delete. Is there a way to disable the panGesture when swiping the the left, but leave the panGesture for swiping to the right and revealing the menu?

Was it helpful?

Solution

Also check out some answers on ECSlidingViewController's wiki which include allowing simultaneous gestures to be recognized.

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer
 *)otherGestureRecognizer {
     if ([otherGestureRecognizer.view isKindOfClass:[UIScrollView class]]) {
         return YES;
     } else {
         return NO;
     } }

OTHER TIPS

As a workaround you can use UIView placed in the "background" of your controller and connect panGesture to it. So instead of

[self.view addGestureRecognizer:self.slidingViewController.panGesture];

I used UIView outlet

@property (strong, nonatomic) IBOutlet UIView *slideOutArea;

and then in proper method like viewWillAppear

[self.slideOutArea addGestureRecognizer:self.slidingViewController.panGesture];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top