CALayer: callback when animation ends?

Posted by carloe on Stack Overflow See other posts from Stack Overflow or by carloe
Published on 2010-06-14T23:26:16Z Indexed on 2010/06/14 23:32 UTC
Read the original article Hit count: 251

Hi All,

I have been running into some issues with animating multiple CALayers at the same time, and was hoping someone could point me in the right direction.

My app contains an array of CALayer. The position of each layer is set to (previousLayer.position.y + previousLayer.bounds.height), which basically lays them out similar to a table. I then have a method that, every-time it is called, adds a new layer to the stack and sets its Y position is set to 0. The Y positions of all other layers in the array are then offset by the height of the new layer (essentially pushing all old layers down).

What I am having problems with is preventing the adding of new layers until the previous animation has completed. Is there a way to tell when an implicit animation has finished? Or alternatively, if I use CABasicAnimation and animationDidFinish, is there a way to tell which object finished animating when animationDidFinish is called?

© Stack Overflow or respective owner

Related posts about animation

Related posts about core-animation