Question

I am using ECSlidingViewController for hamburger menu and I added code to my viewDidLoad method:

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

Now I have pan gesture to show right menu or to hide. It's okay. But I have on view slider and it's really hard to get him working. I must tap on exact position. Is it possible to set that in exact rectangle (in view that contains slider) the slider would be answering on gesture and on other parts it would be working as now?

And one more question. When I have navigation controller with table and then I went on detail and then I show right menu it's okay but when I want to close it by pan I first go back in navigation and then close menu. Is it possible to change this order?

Was it helpful?

Solution

Have you tried setting UIGestureRecognizerDelegate and handling the both gesture recognizes in similar fashion as described in FAO?

e.g.:

#pragma mark - UIGestureRecognizerDelegate

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    if ([otherGestureRecognizer.view isKindOfClass:[UISlider class]]) {
        return YES;
    } else {
        return NO;
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top