title: CCNode with children properties and actions
body: <p>I'm pretty new to cocos2d development and ran into a problem of getting a valid <code>boundingBox</code> and <code>contentSize</code>, and running <code>CCAction</code>s on <code>CCNode</code>s with children. It seemed to me that if your <code>CCNode</code> has children and you call <code>boundingBox</code> (for example) on that <code>CCNode</code>, you should get a <code>CGRect</code> of that <code>CCNode</code> that takes into account its children. Or is it that I'm just organizing my code incorrectly..?</p>
  
  <p>Anyway, I've written a small category for <code>CCNode</code> that seems to return the correct <code>boundingBox</code> and <code>contentSize</code> and runs actions on its children.</p>
  
  <pre><code>@implementation CCNode(Children)
  
  - (CGRect)boundingBoxC {
      if (self.boundingBox.size.width != 0 || self.boundingBox.size.height != 0) {
          return self.boundingBox;
      }
  
      CGRect holderRect = CGRectZero;
  
      for (int i = 0; i &lt; self.children.count; i++) {
          CCNode *node = [self.children objectAtIndex:i];
          holderRect = CGRectUnion(holderRect, node.boundingBoxC);
      }
  
      return holderRect;
  }
  
  - (CGSize)contentSizeC {
      return self.boundingBoxC.size;
  }
  
  - (void)runActionC:(CCAction *)action {
      [self runAction:action];
  
      for (int i = 0; i &lt; self.children.count; i++) {
          id action2 = [action copy];
          CCNode *node = [self.children objectAtIndex:i];
          [node runActionC:action2];
          [actions2 release];
      }
  }
  
  @end
  </code></pre>
  
  <p>I'd love to get some feedback on this. For example, I started by trying to use the name <code>boundingBox</code> instead of <code>boundingBoxC</code>, but wasn't confident that that was good practice (it involved swizzling). Or if there's a more comprehensive, elegant solution to this, I'd love to hear about it.</p>
  
  <p>Thanks!</p>