views:

563

answers:

1

I am using the UIImageView to animate a bunch of images. I know that I can change the speed by altering animationDuration, but that doesn't seem to take effect until the animation is restarted.

My problem is that beside not really wanting to have to restart the animation as this limits me to only being able to change the speed once per cycle, there also doesn't seem to be a way to find out what frame is currently being shown and I would therefore have to rely on a timer to "guess" which one it is.

So my question is whether there is a way to change the speed without restarting the animation and if not is there some way I could avoid the aforementioned problem? I'm not too keen to write my own animation class, but may end up having to if there isn't a nicer solution.

A: 

I'm not sure if this applies to the UIImageView superclass, but UIView class has the following property, which defaults to NO:

setAnimationBeginsFromCurrentState:(BOOL)fromCurrentState

Upon changing to YES and calling the commitAnimations method the subsequent call to beginAnimations:context: will begin right at the point the animation was stopped before.

arul
I think what he's asking about is the ability of UIImageViews to cycle through a set of images as an "animation", not your traditional Core-Animation-enabled effects.
Brad Larson