同时播放多个动画效果很容易,多次调用addAnimation或者CAAnimationGroup就可以。那么如何序列化播放多个动画呢?
搜索了一下,也不知道是我没搜到,还是苹果就没有提供相应的封装,反正我是没看到官方的做法。
那就自己搞个解决方案吧。
看了一下CAAnimation的定义,发现有个delegate,
@interface CAAnimation : NSObject
<NSCoding, NSCopying, CAMediaTiming, CAAction>
{
@private
void *_attr;
uint32_t _flags;
}
/* Creates a new animation object. */
+ (instancetype)animation;
/* Animations implement the same property model as defined by CALayer.
* See CALayer.h for more details. */
+ (id)defaultValueForKey:(NSString *)key;
- (BOOL)shouldArchiveValueForKey:(NSString *)key;
/* A timing function defining the pacing of the animation. Defaults to
* nil indicating linear pacing. */
@property(strong) CAMediaTimingFunction *timingFunction;
/* The delegate of the animation. This object is retained for the
* lifetime of the animation object. Defaults to nil. See