アニメーション中に要素をドラッグする必要があります。要素が画面の上部から落ちるので、アニメーション中でもユーザーが好きな場所にドラッグできるようにする必要があります ありがとう
2 に答える
1
touchesBegan メソッドを使用して、ユーザーが要素に触れたことを検出できます。
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
if (touch != nil && (touch.view == elementView))
//do your stuff
}
次に、要素の位置をタッチ位置に設定し、アニメーションを削除します。
elementView.center = [touch locationInView:self.view];
[elementView.layer removeAllAnimations];
これはうまくいくはずです。次に、同様の touchesMoved メソッドを使用して、ドラッグ中に位置を更新できます。
于 2012-10-25T13:59:56.797 に答える
0
UIView
ブロックベースのアニメーションを使用しているため、次を使用してみてください。
animateWithDuration:delay:options:animations:completion:
UIViewAnimationOptionAllowUserInteraction
オプションで。
于 2012-10-25T14:24:34.500 に答える