私はそれを止めるまで繰り返す必要があるアニメーションを持っています。iOS - 繰返しUIAnimationを停止しますか?
ボタンをクリックした後でアニメーションを停止するにはどうすればよいですか?
私はそれを止めるまで繰り返す必要があるアニメーションを持っています。iOS - 繰返しUIAnimationを停止しますか?
ボタンをクリックした後でアニメーションを停止するにはどうすればよいですか?
Uでは代わりにCABasicAnimationを使用できます。 uはそれを停止したいとき
CABasicAnimation *appDeleteShakeAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
appDeleteShakeAnimation.autoreverses = YES;
appDeleteShakeAnimation.repeatDuration = HUGE_VALF;
appDeleteShakeAnimation.duration = 0.2;
appDeleteShakeAnimation.fromValue = [NSNumber numberWithFloat:-degreeToRadian(5)];
appDeleteShakeAnimation.toValue=[NSNumber numberWithFloat:degreeToRadian(5)];
[self.layer addAnimation:appDeleteShakeAnimation forKey:@"appDeleteShakeAnimation"];
次に、あなただけの
があなたはこれを試してみてください...あなたは一つの他のオプションUIViewAnimationOptionAllowUserInteraction
を追加する必要が
[self.layer removeAnimationForKey:@"appDeleteShakeAnimation"];
呼び出すことができます。
[UIView animateWithDuration:2 delay:0 options:UIViewAnimationCurveLinear | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat | UIViewAnimationOptionAllowUserInteraction animations:^
{
view.frame = CGRectMake(0, 100, 200, 200);
} completion:^(BOOL finished)
{
if(! finished) return;
}];
アニメーションを停止するには、
[view.layer removeAllAnimations];
具体的な質問に対する優れた回答。アニメーション表示のための別のアプローチを示唆するものではありません。よくやった。 – SSemashko
@Scarmysun:感謝のおかげで –
[UIView animateWithDurationを繰り返すハンドラを持つ方法](http://stackoverflow.com/questions/6766955/how-to-have-a-handler-to-repeat-uiview-animatewithduration) ) – sch