user1248961
user1248961

Reputation:

Animating two views with different start times and same finish time

I am trying to find a way to animate two views in this way: they will start animating at different times but end their animations at the same time.

Think of a horse race where one horse starts after the other, but they both reach the finish line at the same time.

Its not a grouped animation. Also, how to I tell an animation to wait until a certain time to start?

Does anyone have any pointers on how to do this?

TIA

Upvotes: 0

Views: 341

Answers (1)

tim
tim

Reputation: 1682

Use [UIView animateWithDuration:delay:options:animations:completion:]

Example:

[UIView animateWithDuration:1.0f animations:^{
    // first animation code here
}];

[UIView animateWithDuration:0.5f delay:0.5f options:UIViewAnimationCurveEaseIn animations:^{         
    // second animation code here
} completion:^(BOOL finished) {

}];

Upvotes: 1

Related Questions