iOS: align DoricLayout fix when super is fit but all sub are most

This commit is contained in:
pengfei.zhou 2022-08-23 18:15:38 +08:00 committed by osborn
parent 95a16435f3
commit f849d4bb34

View File

@ -624,15 +624,6 @@ - (void)measureVLayoutContent:(CGSize)remaining limitTo:(CGSize)limit {
contentWeight += layout.weight; contentWeight += layout.weight;
} }
self.contentWeight = contentWeight; 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) { if (had) {
contentHeight -= self.spacing; contentHeight -= self.spacing;
} }
@ -679,6 +670,17 @@ - (void)measureVLayoutContent:(CGSize)remaining limitTo:(CGSize)limit {
contentHeight -= self.spacing; 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.contentWidth = contentWidth;
self.contentHeight = contentHeight; self.contentHeight = contentHeight;
@ -709,15 +711,6 @@ - (void)measureHLayoutContent:(CGSize)remaining limitTo:(CGSize)limit {
contentWeight += layout.weight; contentWeight += layout.weight;
} }
self.contentWeight = contentWeight; 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) { if (had) {
contentWidth -= self.spacing; contentWidth -= self.spacing;
} }
@ -761,7 +754,17 @@ - (void)measureHLayoutContent:(CGSize)remaining limitTo:(CGSize)limit {
contentWidth -= self.spacing; 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.contentWidth = contentWidth;
self.contentHeight = contentHeight; self.contentHeight = contentHeight;
} }