title: SpriteKit detect if node is removed from parent
body: <p>Is there a method that gets called every time a node is deleted? or added?</p>
  
  <p>Along the terms of <code>touchesBegan</code> a method that gets called every time a touch on the screen happens.</p>
  
  <p>or <code>touchesMoved</code> a method that gets called when a node gets touched and moved.</p>
  
  <p>So is there such a method that gets called when a node gets <code>removeFromParent</code>?</p>
  
  <p>I am currently using the <code>update</code> method to detect if a node is still present like:</p>
  
  <pre><code>SKNode *n = [self childNodeWithName: @"n"];
  if (!n)
  {
      // no n
      if (life != 0)
      {
          [self addChild:_n);
          life--;
      }
  }
  </code></pre>
  
  <p>Now when ever that node is missing I remove 1 life, and then add the node again.</p>
  
  <p>The problem is the update method is running too fast that 2 lives are removed every time the node is removed. I believe this is because adding the node back is kinda slower that the update method. So it takes 2 loops on the update method before it detects that the node is present again.</p>