【发布时间】:2013-02-14 00:24:32
【问题描述】:
我需要我的图像视图在每个动画的开头和结尾更改其 .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?
谢谢!
【问题讨论】:
-
您在寻找哪种类型的动画?您可以尝试使用 [myView commitAnimations]。见这里:raywenderlich.com/2454/how-to-use-uiview-animation-tutorial
-
这个问题需要核心动画...
标签: ios cocoa-touch core-animation quartz-graphics