iOS:fix when LayoutSpec.MOST and weight both setted

This commit is contained in:
pengfei.zhou
2020-04-10 16:14:27 +08:00
committed by osborn
parent 528e6625b5
commit b266fdaa20
3 changed files with 35 additions and 63 deletions

View File

@@ -77,14 +77,22 @@ - (void)measure:(CGSize)targetSize {
CGFloat width;
CGFloat height;
if (self.widthSpec == DoricLayoutMost) {
width = self.measuredWidth = targetSize.width;
if (self.view.superview.doricLayout.layoutType == DoricHLayout && self.weight > 0) {
width = self.measuredWidth = 0;
} else {
width = self.measuredWidth = targetSize.width;
}
} else if (self.widthSpec == DoricLayoutJust) {
width = self.measuredWidth = self.width;
} else {
width = targetSize.width;
}
if (self.heightSpec == DoricLayoutMost) {
height = self.measuredHeight = targetSize.height;
if (self.view.superview.doricLayout.layoutType == DoricVLayout && self.weight > 0) {
height = self.measuredWidth = 0;
} else {
height = self.measuredHeight = targetSize.height;
}
} else if (self.heightSpec == DoricLayoutJust) {
height = self.measuredHeight = self.height;
} else {