title: Subview implementation of gestureRecognizerShouldBegin: interferes with parent view's implementation of that method
body: <p>I have a ParentViewController whose view has a subview. I want ParentViewController to have the initial opportunity to evaluate gestures in its view, and only upon failure of those gestures should the subview then have the chance to evaluate the gesture. But instead things seem to be going the opposite direction, and the subview is actually evaluating a pinch gesture that belongs to the parent view. Here's how things are set up:</p>
  
  <p>ParentViewController has a pinch gesture recognizer whose delegate is set to ParentViewController:</p>
  
  <pre><code>pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
  pinchRecognizer.delegate = self;
  [self.view addGestureRecognizer:pinchRecognizer];
  </code></pre>
  
  <p>ParentViewController implements the <code>UIGestureRecognizerDelegate</code> protocol, specifically implementing the method <code>gestureRecognizerShouldBegin:</code></p>
  
  <pre><code>- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer  //DEPENDENCY
  {
      return [gestureRecognizer isKindOfClass:[UIPinchGestureRecognizer class]];
  }
  </code></pre>
  
  <p>ParentViewController's view has a subview. The subview has a tap gesture recognizer and a pan recognizer:</p>
  
  <pre><code>_tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(stepTapped:)];
  [self addGestureRecognizer:_tapRecognizer];
  _tapRecognizer.numberOfTapsRequired = 1;
  _tapRecognizer.delegate = self;
  
  _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
  [self addGestureRecognizer:_panRecognizer];
  _panRecognizer.maximumNumberOfTouches = 1;
  _panRecognizer.delegate = self;
  </code></pre>
  
  <p>The subview also implements the <code>UIGestureRecognizerDelegate</code> protocol, specifically implementing the method <code>gestureRecognizerShouldBegin:</code></p>
  
  <pre><code>- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
  {
      if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
          CGPoint translation = [(UIPanGestureRecognizer *)gestureRecognizer translationInView:[self superview]];
          return (fabsf(translation.x) &gt; fabsf(translation.y) &amp;&amp; translation.x &lt; 0);
      } else if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
          return YES;
      }
      return NO;
  }
  </code></pre>
  
  <p>Finally, ParentViewController tells the subview's gesture recognizers to only run when its' own pinch gesture fails:</p>
  
  <pre><code>[subview.panRecognizer requireGestureRecognizerToFail:pinchRecognizer]; //GESTURE DEPENDENCY
  [subview.tapRecognizer requireGestureRecognizerToFail:pinchRecognizer]; //GESTURE DEPENDENCY
  </code></pre>
  
  <p>Despite these last two lines of code, I find that the subview's <code>gestureRecognizerShouldBegin:</code> method gets called before that of ParentViewController. Furthermore, the implementation of <code>gestureRecognizerShouldBegin:</code> in ParentViewController won't even run unless I modify the subview's implementation to return <code>YES</code> if a pinch gesture is taking place (see final line):</p>
  
  <pre><code>- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
  {
      if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
          CGPoint translation = [(UIPanGestureRecognizer *)gestureRecognizer translationInView:[self superview]];
          return (fabsf(translation.x) &gt; fabsf(translation.y) &amp;&amp; translation.x &lt; 0);
      } else if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
          return YES;
      }
     return [gestureRecognizer isKindOfClass:[UIPinchGestureRecognizer class]];
  }
  </code></pre>
  
  <p>With the above code, the subview's <code>gestureRecognizerShouldBegin:</code> runs and, upon returning <code>YES</code> at the end if it's a pinch gesture, ParentViewController's <code>gestureRecognizerShouldBegin:</code> gets called.</p>
  
  <p>In case it isn't clear, the behavior I expect is that the ParentViewController's <code>gestureRecognizerShouldBegin:</code> always gets called first, and only upon failure will the subviews' implementation get called.</p>