Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As far as I can tell, there is not a callback to know when the imageView's animation is finished. This is unfortunate, because it means that to remove the animation when the imageView is finished animating, you will need repeatedly check the imageView's <code>isAnimating</code> method until it returns false. The following is an example of what I mean:</p> <p>You might be able to do something like this—in your original code, add the following line</p> <pre><code>[loadingImageView startAnimating]; [images release]; [self performSelector:@selector(checkIfAnimationIsFinished) withObject:nil afterDelay:4.5f]; </code></pre> <p>Then create a method</p> <pre><code>-(void)checkIfAnimationIsFinished { if (![loadingImageView isAnimating]) { [loadingImageView release]; } else { [self performSelector:@selector(checkIfAnimationIsFinished) withObject:nil afterDelay:0.5f]; } } </code></pre> <p>This was just an example, I used the values 4.5f and 0.5f because, unfortunately, the timing is not precise, it is more of a ballpark figure. 4.9f and 0.1f might work better. Regardless, the problem is that if you set the method to fire 5.0f seconds after you start the animation, it is not 100% certain that the animation will be be finished or not. So you will need to check repeatedly if it is not finished.</p> <p>Anyway, this is not the cleanest solution, but unless someone else knows how to get a callback when an imageView is finished animating, I don't know of a better solution.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload