iOS:fix space error when no child

This commit is contained in:
pengfei.zhou
2020-03-02 14:33:08 +08:00
committed by osborn
parent 3ce9d7b69b
commit 67f27bf367
2 changed files with 154 additions and 1 deletions

View File

@@ -393,7 +393,9 @@ - (CGSize)sizeThatFits:(CGSize)size {
contentHeight = MAX(contentHeight, childSize.height + childConfig.margin.top + childConfig.margin.bottom);
contentWeight += childConfig.weight;
}
contentWidth -= self.space;
if (self.subviews.count > 0) {
contentWidth -= self.space;
}
self.contentWidth = contentWidth;
self.contentHeight = contentHeight;
self.contentWeight = contentWeight;