0

I need to perform 9 animations where each animation starts after previous one. So I have huge gigantic piece of code with UIView animateWithDuration calls. It really looks ugly :) Is there any better options than making 8 additional methods and nesting them?

Centurion
  • 14,106
  • 31
  • 105
  • 197

2 Answers2

1

Core Animation is your friend. http://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html

Or you can write all of these 9 steps into one method by using block-based animation method. But it still dosen't look beautiful and iOS 4 is requied.

xuzhe
  • 5,100
  • 22
  • 28
0

You can still use the UIView animation or coreanimation and use the delegate call back i.e:

    [UIView beginAnimations:@"fadeIn" context:nil];
    [UIView setAnimationDuration:0.3];
    [UIView setAnimationDidStopSelector:@selector(finishAnimation:finished:context:)];
    [UIView setAnimationDelegate:self];
    theview.alpha = 1;
    [UIView commitAnimations];

then in the finishAnimation method you can call another animation.

user281300
  • 1,427
  • 2
  • 19
  • 31
  • Thanks but It looks like apple is pushing forward block animations so I will stick with huge large code :) There is a post about setAnimationDidStopSelector being discouraged http://stackoverflow.com/questions/5267415/why-is-setanimationdidstopselector-discouraged – Centurion Aug 17 '11 at 09:02