ブロックレベルのテクニックを使ってアニメーションをやっています。私は一定の条件に基づいてアニメーションを停止したい。アニメーションの完成をどう止めるのですか?続き既に実行中のアニメーションを停止する方法
は、アニメーションのための私のコードです:
[UIView animateWithDuration:2.0 delay:0.0 options:UIViewAnimationOptionAllowUserInteraction
animations:^{
if([arrAns count]>0)
vwb1.center = CGPointMake(260, 40);
}
completion:^(BOOL finished){
[UIView animateWithDuration:1.5 delay:0.0 options:UIViewAnimationOptionAllowUserInteraction
animations:^{
if([arrAns count]>1)
vwb2.center = CGPointMake(260, 100);
}
completion:^(BOOL finished){
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionAllowUserInteraction
animations:^{
if([arrAns count]>2)
vwb3.center = CGPointMake(260, 160);
}
completion:^(BOOL finished){
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionAllowUserInteraction
animations:^{
if([arrAns count]>3)
vwb4.center = CGPointMake(260, 220);
}
completion:^(BOOL finished){
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
if([arrAns count]>4)
vwb5.center = CGPointMake(260, 280);
} completion:nil];
}];
}];
}
];
}];
私はnnotキーに基づいて、それを削除することができますので、私はここに任意のキーを持っていないです。 removeallanimationという機能もありますが、使用できません。誰かがそれを使用する方法について私を助けることができれば、それはまたうまくいくでしょう。
編集:私はそれを行う方法を考え出し[OK]を、私は次のコード使用して、それをしています:
[self.view.layer removeAllAnimations];
をしかし、今、私はまだ開始していない私のブロックレベルのアニメーションがまだ実行されている問題を抱えています。したがって、2番目のブロックでアニメーションを削除すると、残りのブロックが実行されます。私もそれをやめる必要があります。
おかげ
パンカジ
すべてのアニメーションを削除しましたか? –
@Praveen今私のメッセージをチェックしてください。アップデートがあります... – pankaj
すべてのレイヤーのアニメーションを別々に停止する必要があります。 –