关于removeAllChildren

清理当前node的所有子节点?然后ref子节点引用计数会减1吗?

remove并不会立即清除节点

1赞

会的,要学会看源代码啊。

void Node::removeAllChildren()
{
    this->removeAllChildrenWithCleanup(true);
}
void Node::removeAllChildrenWithCleanup(bool cleanup)
{
    _children.clear();
}

void Node::detachChild(Node *child, ssize_t childIndex, bool doCleanup)
{
    _children.erase(childIndex);//rc-1
}

/*
Vector<Node*> _children;        ///< array of children nodes

template<class T>
class Vector
{
	void clear()
    {
        for( auto& it : _data) {
            it->release();//rc-1
        }
        _data.clear();
    }
};
*/
1赞

我发现我的问题100%都是你回答的 给你点个赞

看了一下,感觉还是问下比较稳~~~~~

比较闲没办法,找点事情做 :innocent: