From f849d4bb341c5955ae87341332e2e4ed29acdfcf Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Tue, 23 Aug 2022 18:15:38 +0800 Subject: [PATCH] iOS: align DoricLayout fix when super is fit but all sub are most --- doric-iOS/Pod/Classes/Shader/DoricLayouts.m | 41 +++++++++++---------- 1 file changed, 22 insertions(+), 19 deletions(-) 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; }