swisscheese
swisscheese

Reputation: 331

Blocking on UIImageView animation, or, "while not finished animating, spin"

I'm currently animating many images via 4 UIImageViews, and all is well on that front. The animations complete as expected, and I am assuming that they run inside their own NSThread, as execution continues despite the animation. Of course, this is good and expected behaviour, as I definitely wouldn't want my whole app to halt until the animation finishes.

However, I need to kick off a method which needs to depend on whether the animation is running or not.

The following code is bad as I understand, as introducing loops and other delays inside the main thread causes instability.

while([self.fooImgView isAnimating])
        ;

This code effectively halts execution of the whole app. I need to find a way to "spin" until the animation completes, without wedging the app.

Any advice on this would be greatly appreciated.

Thanks!

sc.

Upvotes: 0

Views: 321

Answers (1)

Luis
Luis

Reputation: 1302

If you use block animations like this one, you can use the completion block to call some delegate or execute your method

Upvotes: 1

Related Questions