如何确定精灵是否在图层中

IMu*_*ode 3 cocos2d-iphone cclayer

对不起,如果这听起来很琐碎.我只是没有得到它.如何确定特定精灵是否已经存在于图层中?基本上,我需要在确定是否将其添加到图层之前检查这一点.

oop*_*ogy 6

if ( [ myNode.children indexOfObject:sprite ] == NSNotFound ) {

     // you can add the code here

}
Run Code Online (Sandbox Code Playgroud)