Question

I have three animations. But I want to play these respectively, not at the same time. All of animations are instance of CABasicAnimation. How can i achieve this ?

Thanks.

Was it helpful?

Solution

A CABasicAnimation is a subclass of CAAnimation. CAAnimation has a delegate property. This delegate is called with

- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag

when one animation did stop (either forced or finished).

So set your CABasicAnimation delegate and implement the animationDidStop:finished: delegate method, check that the animation has finished

- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
{
  if (theAnimation == myFirstAnimation)
     if (flag)
         {}
     } 
  }
}

and you are good to go.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top