Reputation: 8845
In the world of delegates and detectors, I'm having trouble finding a method for detecting if an animation I am playing is playing or not. Once the animation is done, I want the UIImageView to fade out and remove itself from its superview.
I am using the common animationImages
value of the UIImageView.
Right now, I have a once-per-second looped checker looking at the UIImageView's animates
value, and determining if it's still playing.
But this feels a bit excessive, so does anyone know a smarter method of doing this, possibly with custom classing the UIImageView if thats what it takes ?
Upvotes: 0
Views: 368
Reputation: 17478
If you are using UIImageView's animationImages
property, then you might need to follow Eugene's solution.
Immediately after calling the UIImageView's startAnimating
method, you start an NSTimer which has to be fired after animationDuration
. In the fired timer method, you could hide the imageview.
Upvotes: 1
Reputation: 10045
If you are setting you're UIImageView
's animationDuration
property, why don't you try creating a timer which will fire after that same duration and set your UIImageView
hidden in some method?
Upvotes: 0