iOS:fix when set weight error

This commit is contained in:
pengfei.zhou 2020-03-20 15:27:09 +08:00 committed by osborn
parent 365b89cfa6
commit 3eda0358d1

View File

@ -106,6 +106,13 @@ - (CGSize)measureSize:(CGSize)targetSize {
if (config.heightSpec == DoricLayoutWrapContent) { if (config.heightSpec == DoricLayoutWrapContent) {
height = contentSize.height + padding.top + padding.bottom; height = contentSize.height + padding.top + padding.bottom;
} }
if (config.weight) {
if ([self.superview isKindOfClass:[DoricVLayoutView class]]) {
height = self.height;
} else if ([self.superview isKindOfClass:[DoricHLayoutView class]]) {
width = self.width;
}
}
return CGSizeMake(width, height); return CGSizeMake(width, height);
} }