I'm using animateWithDuration:animations:completion:
to move several elements of my User Interface (about 4 elements) before removeFromSuperview:
is called.
My question is, how can I know that all those animations have completed before calling removeFromSuperview:
?
Ok, to answer my own question.
I ended up doing something like this:
I hope this can serve as an example for someone else.
You can also use CATransaction. It will catch any embedded animations:
This would allow you to not have to keep track of the animations yourself.
Create a dispatch queue, suspend it by the number of animations you are doing. Add a block to the queue that does the remove from superview. In the completion block of each animation resume the suspended queue. When the last one completes, the queued block will run.