我需要我的图像视图在每个动画的开头和结尾更改其 .image 。
这是动画:
- (void)performLeft{
CGPoint point0 = imView.layer.position;
CGPoint point1 = { point0.x - 4, point0.y };
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"position.x"];
anim.fromValue = @(point0.x);
anim.toValue = @(point1.x);
anim.duration = 0.2f;
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
// First we update the model layer's property.
imView.layer.position = point1;
// Now we attach the animation.
[imView.layer addAnimation:anim forKey:@"position.x"];
}
我知道我可以打电话...
[anim animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)];
但我不知道如何使用动画来更改图像imView
?那么如何使用动画来改变.image
我的图像视图呢?
谢谢!