title: Dragging an UIView inside UIScrollView
body: <p>I am trying to solve a basic problem with drag and drop on iPhone. Here's my setup:</p>
  
  <ul>
  <li>I have a UIScrollView which has one large content subview (I'm able to scroll and zoom it)</li>
  <li>Content subview has several small tiles as subviews that should be dragged around inside it.</li>
  </ul>
  
  <p>My UIScrollView subclass has this method:</p>
  
  <pre><code>- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
      UIView *tile = [contentView pointInsideTiles:[self convertPoint:point toView:contentView] withEvent:event];
      if (tile) {
          return tile;
      } else {
          return [super hitTest:point withEvent:event];
      }
  }
  </code></pre>
  
  <p>Content subview has this method:</p>
  
  <pre><code>- (UIView *)pointInsideTiles:(CGPoint)point withEvent:(UIEvent *)event {
      for (TileView *tile in tiles) {
          if ([tile pointInside:[self convertPoint:point toView:tile] withEvent:event])
              return tile;
      }
  
      return nil;
  }
  </code></pre>
  
  <p>And tile view has this method:</p>
  
  <pre><code>- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
      UITouch *touch = [touches anyObject];   
      CGPoint location = [touch locationInView:self.superview];
  
      self.center = location;
  }
  </code></pre>
  
  <p>This works, but not fully correct: the tile sometimes "falls down" during the drag process. More precisely, it stops receiving touchesMoved: invocations, and scroll view starts scrolling instead. I noticed that this depends on the drag speed: the faster I drag, the quicker the tile "falls".</p>
  
  <p>Any ideas on how to keep the tile glued to the dragging finger?</p>