How do I get an UIImageView to tell me when its animation stops?

Set the duration the animation will go using setAnimationDuration: At the same time you configure performSelector:withObject:withDelay with the same delay as the duration the animation will go on UIView beginAnimations:nil context:nil; UIView setAnimationDuration:1.0; //the animation will last for 1.0s //some animation code here UIView commitAnimations; self performSelector:@selector(someMethodToDisplayLabel) withObject:nil afterDelay:1.0; //someMethodToDisplayLabel will be called after 1.0s.

Beautiful! Exactly what I wanted. – Chris Mar 24 '10 at 17:45 Well, UIImageView has its own startAnimating and stopAnimating methods to do the animation stuffs.

I think that what Chris is using but not to call the UIView animation methods. I used some KVO tricks to try to listen to the value of "isAnimating" or "animating", it does not work. Since UIImageView has the animationDuration and animationRepeatCount properties, I think it is possible to estimate when will an animation stop (duration * repeat count).

– zonble Mar 24 '10 at 17:52 Yep, my answer suggests to use these duration and repeat count properties to figure when to start your own animation. – Jaanus Mar 25 '10 at 0:02.

Doesn't look like there is an event/delegate for this. My first instinct would be to calculate the length of the animation yourself, and then set up an NSTimer so that when the animation ends, NSTimer fires displaying whatever you want to display next.

I have a UIImageView that is displaying a series of pictures as an animation. This part of the project works well. I want to display a label when the animation ends.

Is there an event that the Imageview will trigger when it's animation ends?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions