user2545330
user2545330

Reputation: 408

Stairs of animation animationWithDuration

I use animationWithDuration for animating elements. An I have 1 animation inserted in completion block of another.

[UIView animateWithDuration:2.0 delay:0.1 options:UIViewAnimationOptionCurveEaseInOut animations:^{

} completion:^(BOOL finished) {

    [UIView animateWithDuration:2.0 delay:0.1 options:UIViewAnimationOptionCurveEaseInOut animations:^{

} completion:^(BOOL finished) {
... //and simple

}];
}];

So I have Stairs of six - nine elements of blocks of animationWithDuration.So how I can optimize this?

Sorry for my English.

Upvotes: 0

Views: 107

Answers (1)

orschaef
orschaef

Reputation: 1337

If you have many nested animations the code quickly becomes very unreadable. So the approach here is maybe to hold an array of all animation blocks and to iterate through them without nesting them.

One possible example how this looks in code is shown here: Multiple UIView Animations Without Nested Blocks

Upvotes: 1

Related Questions