How to pause a UIImageView animation

前端 未结 6 1736
有刺的猬
有刺的猬 2021-02-06 17:03

I have an animation that I\'m displaying using a UIImageView:

imageView.animationImages = myImages;
imageView.animationDuration = 3;
[imageView startAnimating];
         


        
6条回答
  •  野的像风
    2021-02-06 17:30

    Another option is to set the image property as well as the animationImages property. Doing this will display the static image when the UIImageView has its animations stopped.

    Assuming your class is a subclass of UIImageView and have an NSMutableArray of images, do the following:

    self.animationImages = images;
    //yes, I'm skipping the step to check and make sure you have at least one
    //element in your array
    self.image = [images objectAtIndex: 0];
    

提交回复
热议问题