teepusink
teepusink

Reputation: 28892

CAKeyframeAnimation on complete

I have several CAKeyframeAnimation objects in my class.
They all have self as the delegate.

In my animationDidStop function, how can I tell where the call is coming from?
Is there any variable I can pass to CAKeyfameAnimation like an animationID or something?

Thanks,
Tee

Upvotes: 2

Views: 1311

Answers (1)

MHC
MHC

Reputation: 6405

You can use Key-Value coding to set values for arbitrary keys (keys need not be defined in advance) for a CAAnimation object.

For example, you can set a value for a key @"tag" for each CAAnimation object as the following:

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

Later, you can read the value of each object as the following:

[anAnimation valueForKey:@"tag"]; //will return @"dropAnimation" if it's the previous animation

Upvotes: 3

Related Questions