各アニメーションの最初と最後で.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
では、アニメーションを使用して画像ビューのを変更するにはどうすればよいですか?
ありがとうございました!