title: Detecting horizontal swipes in a UIScrollView with a vertical scroll
body: <p>I have a UIScrollView that's around 600 pixels in height and 320 in width. So I'm allowing the user to scroll vertically.</p>
  
  <p>I'm also trying to capture horizontal swipes on the view. The problem seems to be that when a user swipes horizontally with some accidental vertical movement, the UIScrollView scrolls and my touchesEnded delegate method never gets called.  </p>
  
  <p>Here's my code:</p>
  
  <pre><code>- (void)touchesEnded: (NSSet *)touches withEvent: (UIEvent *)event
  {
      UITouch *touch = [touches anyObject];
      CGPoint currentPosition = [touch locationInView:self];
  
      if (currentPosition.x + 35 &lt; gestureStartPoint.x)
      {  
          NSLog(@"Right");
      }    
      else if (currentPosition.x - 35 &gt; gestureStartPoint.x)
      {
          NSLog(@"Left");
      }    
      else if (!self.dragging)
      {
          [self.nextResponder touchesEnded: touches withEvent:event]; 
      }
  
      [super touchesEnded: touches withEvent: event];
  }
  </code></pre>
  
  <p>Does anyone know how I can get this to work even when there is vertical drag involved?</p>