diff --git a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m index 05cd8197..bb36d9ce 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m +++ b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m @@ -624,15 +624,6 @@ - (void)measureVLayoutContent:(CGSize)remaining limitTo:(CGSize)limit { contentWeight += layout.weight; } self.contentWeight = contentWeight; - if (!existsContent) { - for (__kindof UIView *subview in self.view.subviews) { - DoricLayout *layout = subview.doricLayout; - if (layout.disabled) { - continue; - } - contentWidth = MAX(contentWidth, layout.takenWidth); - } - } if (had) { contentHeight -= self.spacing; } @@ -679,6 +670,17 @@ - (void)measureVLayoutContent:(CGSize)remaining limitTo:(CGSize)limit { contentHeight -= self.spacing; } } + + if (!existsContent) { + for (__kindof UIView *subview in self.view.subviews) { + DoricLayout *layout = subview.doricLayout; + if (layout.disabled) { + continue; + } + contentWidth = MAX(contentWidth, layout.takenWidth); + } + } + self.contentWidth = contentWidth; self.contentHeight = contentHeight; @@ -709,15 +711,6 @@ - (void)measureHLayoutContent:(CGSize)remaining limitTo:(CGSize)limit { contentWeight += layout.weight; } self.contentWeight = contentWeight; - if (!existsContent) { - for (__kindof UIView *subview in self.view.subviews) { - DoricLayout *layout = subview.doricLayout; - if (layout.disabled) { - continue; - } - contentHeight = MAX(contentHeight, layout.takenHeight); - } - } if (had) { contentWidth -= self.spacing; } @@ -761,7 +754,17 @@ - (void)measureHLayoutContent:(CGSize)remaining limitTo:(CGSize)limit { contentWidth -= self.spacing; } } - + + if (!existsContent) { + for (__kindof UIView *subview in self.view.subviews) { + DoricLayout *layout = subview.doricLayout; + if (layout.disabled) { + continue; + } + contentHeight = MAX(contentHeight, layout.takenHeight); + } + } + self.contentWidth = contentWidth; self.contentHeight = contentHeight; }