cocos2d-x之Node移除HelloWorld节点

cocos2d-x之Node移除HelloWorld节点
    
    设置HelloWorld标签的标记:
        auto label = LabelTTF::create("Hello World", "Arial", 24);
        label->setTag(12);//为HelloWorld标签添加标记
        
    修改关闭按钮的方法

 1 void HelloWorld::menuCloseCallback(Object* pSender)
 2 {
 3     //Director::getInstance()->end();
 4     do{
 5         Node *pNode = this->getChildByTag(12);//获取HelloWorld标签
 6         CC_BREAK_IF(!pNode);//判断pNode是否存在,如果不存在跳出循环
 7         pNode->removeFromParentAndCleanup(true);//移除标签
 8     }while (0);
 9 
10 
11 
12 #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
13     exit(0);
14 #endif
15 }
原文地址:https://www.cnblogs.com/dudu580231/p/4386341.html