问题描述
我有一个动画使用UIImageView
I have an animation using a UIImageView
myAnimatedView.animationImages = myImages;
myAnimatedView.animationDuration = 1;
myAnimatedView.animationRepeatCount = 1;
[myAnimatedView startAnimating];
如何告诉动画在最后一帧停止或在系列的最后一帧可见的图片?
How can I tell to animation to stop at the last frame or to be visible last frame of the series of images?
提前感谢您
推荐答案
在UIImageView类上有以下文档:
如果animationImages属性包含除nil之外的值,则不使用此属性的内容。
the image property on the UIImageView class has the following docs:"If the animationImages property contains a value other than nil, the contents of this property are not used."
因此,在iOS4中保持动画的最后一帧的诀窍是首先将image属性设置为最后一帧(而animationImages仍然为nil),然后设置animationImages属性并调用startAnimating。动画完成后,将显示image属性。无需回调/委托。
So the trick to hold on the last frame of an animation in iOS4 is to first set the image property to that last frame (while animationImages is still nil), then set the animationImages property and call startAnimating. When the animation completes, the image property is then displayed. No callback/delegate needed.
这篇关于我可以在最后一帧停止UIImageView动画吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!