Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

North Bronson

macrumors 6502
Original poster
Oct 31, 2007
395
1
San José
I'm working though some animation for a project, and it's becoming a little complicated.

I'm using the Core Animation methods on UIView, and it seems like its hard to set up an animation that fires in "stages". Please help me if I'm wrong about this.

Right now, my code looks like:

Code:
const CGFloat animationDuration = 1.0;

[UIView beginAnimations: nil context: nil];

[UIView setAnimationDelay: (animationDuration * 0)];
[UIView setAnimationDuration: animationDuration];

//  Run first animation

[UIView beginAnimations: nil context: nil];

[UIView setAnimationDelay: (animationDuration * 1)];
[UIView setAnimationDuration: animationDuration];

//  Run second animation

[UIView beginAnimations: nil context: nil];

[UIView setAnimationDelay: (animationDuration * 2)];
[UIView setAnimationDuration: animationDuration];

//  Run third animation

[UIView commitAnimations];
[UIView commitAnimations];
[UIView commitAnimations];

But this doesn't feel like the cleanest way to do things. I thought about using the animation delegate to manually fire the appropriate animation after the previous animation completed, but this sounds like it might not be the best solution, either.

Any ideas?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.