From c7f3f74b690fdf8974d607597b0e6fa272d53937 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 9 Apr 2020 10:54:38 +0800 Subject: [PATCH] iOS:fix weight problem --- doric-iOS/Pod/Classes/Shader/DoricLayouts.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m index f06d5a5f..a1b8f50d 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m +++ b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m @@ -272,11 +272,13 @@ - (void)measureVLayoutContent:(CGSize)targetSize { if (layout.disabled) { continue; } - layout.measuredHeight += remaining / contentWeight * layout.weight; + CGFloat measuredHeight = layout.measuredHeight + remaining / contentWeight * layout.weight; + layout.measuredHeight = measuredHeight; //Need Remeasure [layout measureContent:CGSizeMake( layout.measuredWidth - layout.paddingLeft - layout.paddingRight, - layout.measuredHeight - layout.paddingTop - layout.paddingBottom)]; + measuredHeight - layout.paddingTop - layout.paddingBottom)]; + layout.measuredHeight = measuredHeight; contentWidth = MAX(contentWidth, layout.takenWidth); } contentHeight = targetSize.height; @@ -322,11 +324,13 @@ - (void)measureHLayoutContent:(CGSize)targetSize { if (layout.disabled) { continue; } - layout.measuredWidth += remaining / contentWeight * layout.weight; + CGFloat measuredWidth = layout.measuredWidth + remaining / contentWeight * layout.weight; + layout.measuredWidth = measuredWidth; //Need Remeasure [layout measureContent:CGSizeMake( - layout.measuredWidth - layout.paddingLeft - layout.paddingRight, + measuredWidth - layout.paddingLeft - layout.paddingRight, layout.measuredHeight - layout.paddingTop - layout.paddingBottom)]; + layout.measuredWidth = measuredWidth; contentHeight = MAX(contentHeight, layout.takenHeight); } contentWidth = targetSize.width;