0

I am programatically creating UIImageViews of an iVar called *fly.

I am calling a series of methods containing different CAKeyFrameAnimations. These methods are chained together using the CAKeyFrameAnimations delegate method 'animationDidStop:(CAAnimation *)anim finished:(BOOL)flag'.

Now this is fine if I only have one instance of *fly.

However, when I have created many instances of *fly, how do I tell which UIImageView has finished animating with it's then current CAKeyFrameAnimation calling the 'animationDidStop...' method?

I know how to identify the CAKeyFrameAnimation as I have given them a key. I also have each new *fly UIImageView tagged with an integer, but how do I tie the two into the 'animationDidStop...' method?

Any help would be most appreciated.

Thanks in advance

Paulh

  • `NSString *animationKey = [NSString stringWithFormat:"frameAnimationKey%d", imageView.tag];` ?! – Till Mar 03 '13 at 21:43

1 Answers1

0

You can make use of CAAnimation's KVO compliance.

[anim setValue:yourView forKey:"view"]

And extract this value in animationDidStop

guenis
  • 2,520
  • 2
  • 25
  • 37