我想帮助一些策略来对一些动画进行排序。
我对 UIImageView 进行了子类化,以便可以在图像上编写一些自定义动画操作。我实现了一些方法用作我可以在我的图像示例中调用的操作:
-(void)rotateAnim; //rotates the image by a few degrees using a CGAffine Transform
-(void)numbersFlashAnim; //uses the UIImageVew.animationImages array for a 14 frame animation.
-(void)moveLeftAnim; //uses another CGAffine Transform to change the imageView's position.
在我的 viewDidLoad 方法中,我创建了一个 UIImageView 子类的实例。有哪些方法可以按顺序调用这些动画?
我正在考虑使用 NSTimer 来处理动画,但不确定是否可以编写 NSTimer 对象来处理多个方法调用。
例子:
[imageView rotateAnim]; //when this animation is done, I want to call:
[imageView numbersFlashAnim];
我见过几个关于使用 NSTimer 的问题,但没有一个与这个问题特别相关。注意:我看到苹果网站上的开发文档也推荐使用 performSelector:withObject:afterDelay: 在某些情况下,但想知道这是否会提供足够的灵活性。
另外,我已经看过 Cocos2d 框架,虽然我可以使用他们的方法 ~(Sequence actions: etc, ) 我选择用 UIKit/Foundation 等来解决这个问题。