How to check when animation finishes if animation block is
Posted
by
pumpk1n
on Stack Overflow
See other posts from Stack Overflow
or by pumpk1n
Published on 2011-01-04T02:39:38Z
Indexed on
2011/01/04
2:54 UTC
Read the original article
Hit count: 318
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!
© Stack Overflow or respective owner