0

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.

Muddu Patil
  • 713
  • 1
  • 11
  • 24
user2254860
  • 76
  • 1
  • 7
  • Sequential / Chained / "One after another" CAAnimations has been asked for many times before. As the [FAQ] says: "Please [look around](http://stackoverflow.com/search) to see if your question has been asked before." – David Rönnqvist Apr 29 '13 at 09:57

1 Answers1

0

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.

Pfitz
  • 7,336
  • 4
  • 38
  • 51