In Xcode 5.1, I created a simple test application for the iPhone:

Structure: scrollView -> contentView -> imageView -> image 1000 x 1000top.
And at the bottom of the application with one view, I have seven draggable user UIViews.
Drag and drop is implemented in Tile.m using methods touchesXXXX.
My problem: when I add the draggable fragment to contentViewin the ViewController.m file - I can no longer drag it:
- (void) handleTileMoved:(NSNotification*)notification {
Tile* tile = (Tile*)notification.object;
if (tile.superview != _scrollView && CGRectIntersectsRect(tile.frame, _scrollView.frame)) {
[tile removeFromSuperview];
[_contentView addSubview:tile];
[_contentView bringSubviewToFront:tile];
}
}
touchesBeganno longer called for Tile, as if scrollViewmasking this event.
, UIScrollView ( GameBoard.m):
- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
UIView* result = [super hitTest:point withEvent:event];
NSLog(@"%s: %hhd", __PRETTY_FUNCTION__,
[result.superview isKindOfClass:[Tile class]]);
self.scrollEnabled = ![result.superview isKindOfClass:[Tile class]];
return result;
}
, 0 .