Note that there are some explanatory texts on larger screens.

plurals
  1. POCAAnimation's "animationDidStop:" only called once
    primarykey
    data
    text
    <p>I have multiple set of buttons that when clicked, animates from its original position going to its set position. After the object animates, i want it to be removed from the superview. </p> <p>Here's my code for animationDidStop:</p> <pre><code>- (void) animationDidStop:(SKBounceAnimation *)animation finished:(BOOL)flag { [self.cellImageViewGlobal removeFromSuperview]; NSLog(@"Animation didStop called"); } </code></pre> <p>So when I clicked a button (which is self.cellImageViewGlobal), it will animate, then after the animation, it will be removed from the superview. In the proceeding clicks or tap I will make, self.cellImageViewGlobal will not be removed from the superview. I found out that this function is only called once through my logs. </p> <p>I set my self as a delegate in the viewDidLoad:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; self.animateProduct.delegate = self; // animateProduct is the last animation being called in the CAAanimationGroup array } </code></pre> <p>I also set this delegate in my animation function. I don't get what seemed to be the problem with my code. I supposed that every time I will click a button, after the animation it will call the "animationDidStop" function.</p> <p>By the way, I've tried multiple ways or solution to solve it. First is I used blocks. After the animation in the block has been completed, will perform this:</p> <pre><code>completion:^(BOOL finished){ [self.cellImageViewGlobal removeFromSuperview]; } </code></pre> <p>But this code won't wait for the animation in the Simulator to complete. I've learned in Paul Hegarty's lecture that in the Animation code, it finishes executing the code, but it doesn't wait for the animation itself (projected in the simulator) to finish.</p> <p>Hope you could help me with this. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload