I have set up an animation in the following way (self is an UIImageView, myImages an Array of UIImages):
self.animationImages = myImages;
self.animationDuration = 50;
self.animationRepeatCount = 0;
[self startAnimating];
During the anim开发者_开发知识库ation I'd like to check the current image. I tried it the following way
if([self image]==[UIImage imageNamed:@"image1.png"]);
but this does not work. Is there a straight forward way for this? Can I keep track of which image is shown during the animation?
There is no official way to get the currently displayed image (index) from an animated UIImageView. Note: If the animationImages property contains a value other than nil, the contents of the image property is not used at all and will not contain usable data.
Still, you can measure the time that has passed since the animation started and evaluate the current frame/image index yourself.
精彩评论