如何使用核心动画创建图像序列。我想要:
添加图像1并持续1秒,然后移除图像。
添加图像2并持续2秒,然后移除图像。
添加图像1并持续3秒,然后移除图像。
CGImageRef image1 = [self getImage1];
CALayer *image1Layer = [CALayer layer];
image1Layer.bounds = CGRectMake(0, 0, 480, 320);
image1Layer.position = CGPointMake(0, 0);
image1Layer.contents = (id)image1;
CABasicAnimation *animation1 = [CABasicAnimation animationWithKeyPath:@"animation"];
animation1.repeatCount = 0;
animation1.duration = 2.0;
animation1.removedOnCompletion = YES; // i would like to remove image here
animation1.beginTime = AVCoreAnimationBeginTimeAtZero;
[image1Layer addAnimation:animation1 forKey:nil];
以上代码添加了一张图片,但没有删除它。
谢谢。