title: How to cancel UIGestureRecognizer if subview's button pressed
body: <p>I am struggling to get the behaviour I would like from the gesture recognisers, specifically cancelling certain gestures if others have fired.</p>
  
  <p>I have a scrollView set to paging and multiple subviews in each page.  I have added a touch gesture recogniser to scroll to the next or prev page if the user taps to the right or left of the page.</p>
  
  <pre><code>    // Add a gesture recogniser turn pages on a single tap at the edge of a page
      UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureHandler:)];
      tapGesture.cancelsTouchesInView = NO;
      [self addGestureRecognizer:tapGesture];
      [tapGesture release];
  </code></pre>
  
  <p>and my gesture handler:</p>
  
  <pre><code>- (void) tapGestureHandler:(UIGestureRecognizer *) gestureRecognizer {
      const CGFloat kTapMargin = 180;
  
      // Get the position of the point tapped in the window co-ordinate system
      CGPoint tapPoint = [gestureRecognizer locationInView:nil];
  
      // If the tap point is to the left of the page then go back a page
      if (tapPoint.x &gt; (self.frame.size.width - kTapMargin)) [self scrollRectToVisible:pageViewRightFrame animated:YES];
  
      // If the tap point is to the right of the page then go forward a page
      else if (tapPoint.x &lt; kTapMargin) [self scrollRectToVisible:pageViewLeftFrame animated:YES];
  }
  </code></pre>
  
  <p>All works well, except where I have a subview on the page that has buttons in it.  I want to be able to ignore the tap to turn the page if the user touches a button on the subView and I can't figure out how to do this.</p>
  
  <p>Cheers</p>
  
  <p>Dave</p>