序列帧动画保存问题
CAKeyframeAnimation * anim = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
anim.values = @[@1,@1.3,@0];
anim.duration = 0.3;
anim.removedOnCompletion = NO;//1.设置执行完毕后不移除动画,必须否则2无效
anim.fillMode = kCAFillModeForwards;//2.设置保存动画执行结束的状态
[self.layer addAnimation:anim forKey:nil];
[self performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.5];
做序列帧动画的时候难免要保留动画结束后的状态,首先将动画的anim.removedOnCompletion设置为no,默认为yes,让动画结束后不被移除
然后将fillMode改变为您想要的就ok了,forwards是保留最终状态