multi = LayerMultiplex::createWithArray(layers);
调用 multi->switchTo(n);
里面会调用 this->removeChild(_layers.at(_enabledLayer), true); 把当前层remove, 可是当前layer,是被从multi的layerremove掉了,
但是它仍然在multi的Vector<Layer*> _layers;里, 导致其所有儿子不能被释放,所有儿子都还附属在remove掉的那个层里。
所以必须在layer的onEnter函数 重写后 把上次onEnter加进来的儿子全部remove掉才不会内存泄露。
要记住 : child->removeFromParentAndCleanup(true); 它做的是 setParent(NULL)+_children.rease(index) , child的儿子孙子类的只有
做cleanup()动作, 要知道cleanup只是 停掉两个东西而已,(stopAllActions(),unscheduleAllSelectors()) 然后等待内存管理来自动释放。