I want the gesture recognizer to listen to two fingers anywhere on the screen.
Right now I have a UITableView in a subtask that scrolls, of course, and it doesn't seem to pick up the UIGestureRecognizer that I set in the view. When you use two fingers, it just scrolls ...
Is there a way to make the whole look, perhaps a supervisor, listen to the touch of two fingers and when it recognizes it, instead of scrolling through the table view, do what I want?
EDIT : Heres my code, but this is considered a very general question. I just want to have UIGestureRecognizers in all appearance, all this.
navBarTitle.title = @"Crunch"; //opening the menuView from launch //setup the customtable view as a subview in menuView SDMenuViewController *mvc = [[[SDMenuViewController alloc] initWithNibName:@"SDNestedTableView" bundle:nil] autorelease]; [self addChildViewController:mvc]; [mvc didMoveToParentViewController:self]; [menuView addSubview:mvc.view]; [mvc.view setFrame:CGRectMake(mvc.view.frame.origin.x, mvc.view.frame.origin.y, mvc.view.frame.size.width, mvc.view.frame.size.height + 44)]; //add navBarHeight, for some strage reason //add swipe down gesture on for the menu UISwipeGestureRecognizer *swipeClose =[[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(closeMenu)] autorelease]; swipeClose.numberOfTouchesRequired = 2; swipeClose.direction = UISwipeGestureRecognizerDirectionUp; UISwipeGestureRecognizer *swipeOpen = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(openMenu)] autorelease]; swipeOpen.numberOfTouchesRequired = 2; swipeOpen.direction = UISwipeGestureRecognizerDirectionDown; for (UIGestureRecognizer* rec in menuView.gestureRecognizers) { [rec requireGestureRecognizerToFail:swipeClose]; [rec requireGestureRecognizerToFail:swipeOpen]; } for (UIGestureRecognizer* rec in mvc.view.gestureRecognizers) { [rec requireGestureRecognizerToFail:swipeClose]; [rec requireGestureRecognizerToFail:swipeOpen]; } [mvc.view addGestureRecognizer:swipeClose]; [mvc.view addGestureRecognizer:swipeOpen]; [self.view addGestureRecognizer:swipeClose]; [self.view addGestureRecognizer:swipeOpen];
source share