UIImageView を継承するドラッグ可能なクラスがあります。ビューがアニメーション化されていない場合、ドラッグは正常に機能します。ただし、アニメーション中はタッチに反応しません。アニメーションが完了すると、タッチが再び機能します。しかし、タッチ時にアニメーションを一時停止し、タッチが終了したら再開する必要があります。丸一日かけて調べましたが、原因がわかりませんでした。
これが私のアニメーションコードです。
[UIView animateWithDuration:5.0f
delay:0
options:(UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
animations:^{
self.center = CGPointMake(160,240);
self.transform = CGAffineTransformIdentity;
}
completion:nil
];
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
NSLog(@"touch");
CGPoint pt = [[touches anyObject] locationInView:self];
startLocation = pt;
[self.layer removeAllAnimations];
[[self superview] bringSubviewToFront:self];
}