PDA

View Full Version : Pausing animated UIImages?




Danneman101
May 28, 2009, 06:46 PM
Ive got a UIImage that is animated with 26 images in a perpetual loop.

On top of that, the image is accelerated (when tilting the iphone, the imaged goes to the right or the left).

I want to be able to pause and resume the animation by the press of a button, but I cant find a pause-function for animated uiimages.

The problem with [myImage stopAnimating]; is that the image disappears completely - I need it to stay on the screen.

I could probably put another static image with the correct image-frame in the position where the animation was last, but that would be an awful lot of work compared to a pause-function...



jnic
May 29, 2009, 05:49 AM
If you set the UIImageView's image (https://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIImageView_Class/Reference/Reference.html#//apple_ref/occ/instp/UIImageView/image) property then that'll be the image you see when you call stopAnimating.

Danneman101
May 29, 2009, 12:47 PM
Thanks - that helped for the stop-part. For restart Im just getting the location of the stopped image, remove it, and then make a new one.