iOS:fix weight problem

This commit is contained in:
pengfei.zhou 2020-04-09 10:54:38 +08:00 committed by osborn
parent b387491c47
commit c7f3f74b69

View File

@ -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;