How to check when animation finishes if animation block is
- by pumpk1n
I have a controller which adds as subviews a custom UIView class called Circle. Let's call a particular instance of Circle, "circle".
I have a method in Circle, animateExpand, which expands the circle by animating the view.
In the following code (which lives in the controller) I want to alloc and init a circle, add it to a NSMutableArray circleArray, animate the expansion, and at the end of the expansion, i want to remove the object from the array. My attempt:
Circle *circle = [[Circle alloc] init];
[circleArray addObject:circle];
[circle animateExpand];
[circleArray removeObjectIdenticalTo:circle];
[circle release];
The problem is [circleArray removeObjectIdenticalTo:circle]; gets called before the animation finishes. Presumbly because the animation is done on a seperate thread. I cant implement the deletion in completion:^(BOOL finished){ }, because the Circle class does not know about a circleArray.
Any solutions would be helpful, thanks!