title: How to implement method: - (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
body: <p>I have two blocks of code (described also in <a href="https://stackoverflow.com/questions/4841120/how-to-get-the-end-event-of-catransition-animation?answertab=active#tab-top">another topic</a>)</p>
  
  <pre><code>- (void)AnimateImage:(NSString*)direction{
      self.CurrentAnimal.image = [images objectAtIndex:image_nr];
      CATransition *animation = [CATransition animation];
      [animation setDuration:1.0];
      [animation setType:kCATransitionPush];
      if([direction isEqualToString:@"left"]){
          [animation setSubtype:kCATransitionFromLeft];
      }
      else {
          [animation setSubtype:kCATransitionFromRight];
      }
      [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
      [[self.CurrentAnimal layer] addAnimation:animation forKey:nil];
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
  {
      //do what you need to do when animation ends...
  }
  </code></pre>
  
  <p>I know that I need to "set the delegate property and implement the method" to catch animationDidStop event but I'm not able to get it working.</p>
  
  <p>Question - How do I set up my .h and .m files so that I'm able to use this method to execute code when CATransition animation stops?</p>