m_pRoot = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile(“xxxxxxx.json”));
g_scene->addChild( m_pRoot );
那我想释放m_pRoot的时候怎么写?
g_scene->removeChild( m_pRoot );
m_pRoot =NULL;
就可以了吗?是不是不用delete?
m_pRoot = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile(“xxxxxxx.json”));
g_scene->addChild( m_pRoot );
那我想释放m_pRoot的时候怎么写?
g_scene->removeChild( m_pRoot );
m_pRoot =NULL;
就可以了吗?是不是不用delete?
removeChild的时候会默认clear。除了删除控件外还需要删除未使用的纹理。CCTextureCache::sharedTextureCache()-> void removeUnusedTextures();.感谢您对cocostudio的支持。
谢谢 。原来cocos把容器又封装了一层。erase的时候引用计数减一了。。
最好手动控制删除的纹理 不然可能会删除你还要使用的