I try add Node to ListView so:
auto nodeToAdd = loadCcbAsNode("fileccb.ccbi").get();
for (size_t i = 1; i < 10; i++)
{
listView->addChild(nodeToAdd); // it's cocos2d::ui::ListView
// which i load to scene
}
But get so error:
CCASSERT(child->_parent == nullptr, "child already added. It can't be added again");
What i need do?
as it turned out, when i create
auto nodeToAdd = loadCcbAsNode("fileccb.ccbi").get();, nodeToAdd has a type Node, but cocos has special smart pointer NodePtr, and which i calling value with type of NodePtr, it's pointer automatically increments the counter by one, and Node this does not.