如果我添加一個UITextField到openGLView並再次移除它,dealloc永遠不會被調用。將UIView集成到cocos2d:如何發佈UIView元素?
// add a textfield to the openGLView
codeTextfield = [[UITextField alloc] initWithFrame:codeTextfieldFrame];
[[[CCDirector sharedDirector] openGLView] addSubview:codeTextfield];
// remove the textfield
[codeTextfield removeFromSuperview];
// call replaceScene
[CCDirector sharedDirector] replaceScene:[Menu node]];
// dealloc will not be called
我忍受了這個問題很長一段時間,目前還沒有解決方案。
釋放它:
爲了讓計數回0,從視圖中刪除
codeTextfield
後,而不是做這個。 – PengOne 2011-06-09 16:21:20