0
我需要我的圖像視圖在每個動畫的開頭和結尾處更改其.image。在UIImageView啓動/完成動畫後更改圖像
這是動畫:
- (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
?
謝謝!
哪種類型的動畫你找誰?你可以嘗試使用[myView commitAnimations]。看到這裏:http://www.raywenderlich.com/2454/how-to-use-uiview-animation-tutorial – 2013-02-14 04:00:43
那麼這個問題叫核心動畫... – Tanner 2013-02-14 14:48:04