2

クラスに複数の CAKeyframeAnimation オブジェクトがあります。
それらはすべてデリゲートとして自分自身を持っています。

私の animationDidStop 関数では、呼び出しがどこから来ているかをどのように知ることができますか?
animationID などのように CAKeyfameAnimation に渡すことができる変数はありますか?

ありがとう、
ティー

4

1 に答える 1

3

Key-Value コーディングを使用して、CAAnimation オブジェクトの任意のキー (キーを事前に定義する必要はありません) の値を設定できます。

たとえば、各 CAAnimation オブジェクトのキー @"tag" の値を次のように設定できます。

CAAnimation oneOfYourAnimations = [CAAnimation animation];
[oneOfYourAnimations setValue:@"dropAnimation" forKey:@"tag"];

後で、各オブジェクトの値を次のように読み取ることができます。

[anAnimation valueForKey:@"tag"]; //will return @"dropAnimation" if it's the previous animation
于 2011-03-27T20:35:17.393 に答える