diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index 50074ae5ae..620a310bbb 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -987,10 +987,14 @@ LayoutManager* Layout::createLayoutManager() void Layout::doLayout() { + if (!_doLayoutDirty) { return; } + + sortAllChildren(); + LayoutManager* executant = this->createLayoutManager(); if (executant) diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index be7cd54206..c6cab6ec0c 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -261,10 +261,7 @@ void Widget::setContentSize(const cocos2d::Size &contentSize) { _contentSize = getVirtualRendererSize(); } - else - { - _contentSize = contentSize; - } + if (_running) { Widget* widgetParent = getWidgetParent();