メソッド "labelDropped"を呼び出すときに停止したいテキストのフラッシュを作成する簡単なアニメーションがあります。ここ は、アニメーションのコードです:iOS - [layer removeAllAnimations]を使用してアニメーションを削除する
- (void)blinkAnimation:(NSString *)animationID finished:(BOOL)finished target:(UIView *)target
{
float speedFloat = .8;
[UIView beginAnimations:animationID context:target];
[UIView setAnimationDuration:speedFloat];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(blinkAnimation:finished:target:)];
if([target alpha] == 1.0f)
[target setAlpha:0.0f];
else
[target setAlpha:1.0f];
[UIView commitAnimations];
}
次のように、この方法は、私の見解のinitメソッドで呼び出されます。
[self blinkAnimation:@"blinkAnimation" finished:YES target:infoLabel];
ておらず、私はアニメーションを停止するために使用して最終的には、コードを、ワーキング。私も試してみた
[self.layer removeAllAnimations];
: [infoLabel.layer removeAllAnimations];
を...しかし、それはどちらか動作していない「labelDropped」と呼ばれる別のメソッドから呼び出されています。 ありがとうございました。
これはずっと前ですが、他の誰かがそれに出会うのです。 UIViewアニメーションとCore Animationは異なります。コアアニメーションの使用removeAllAnimationsはUIViewアニメーションを停止しません。アニメーションを停止するには、CAAnimationとそのサブクラスを使用する必要があります。 :) –