开发者

How do you code nested UIView animations?

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 op开发者_Python百科tions than making 8 additional methods and nesting them?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜