I have a draggable class that inherits UIImageView. The drag works fine when the view is not animating. But when animating it won\'t respond to touches. Once the animation i
That's because ios places your animating view to the target position, when the animation starts, but draws it on the path. So if you tap the view while moving, you actually tap somewhere out of its frame.
In your animating view's init, set userInteractionEnabled to NO. So the touch events are handled by the superview.
self.userInteractionEnabled = NO;
In your superview's touchesBegan method, check your animating view's presentationLayer position. If they match with the touch position, redirect the touchesBegan message to that view.
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
CGPoint point = [[touches anyObject] locationInView:self.view];
CGPoint presentationPosition = [[animatingView.layer presentationLayer] position];
if (point.x > presentationPosition.x - 10 && point.x < presentationPosition.x + 10
&& point.y > presentationPosition.y - 10 && point.y < presentationPosition.y + 10) {
[animatingView touchesBegan:touches withEvent:event];
}
}