iOS:fix Refreshable

This commit is contained in:
pengfei.zhou
2020-04-08 15:20:38 +08:00
committed by osborn
parent b17ff48c59
commit 5babfb4c9c
3 changed files with 38 additions and 12 deletions

View File

@@ -83,19 +83,25 @@ - (void)apply {
}
- (void)measure:(CGSize)targetSize {
CGFloat width;
CGFloat height;
if (self.widthSpec == DoricLayoutMost) {
self.measuredWidth = targetSize.width;
width = self.measuredWidth = targetSize.width;
} else if (self.widthSpec == DoricLayoutJust) {
width = self.measuredWidth = self.width;
} else {
self.measuredWidth = self.width;
width = targetSize.width;
}
if (self.heightSpec == DoricLayoutMost) {
self.measuredHeight = targetSize.height;
height = self.measuredHeight = targetSize.height;
} else if (self.heightSpec == DoricLayoutJust) {
height = self.measuredHeight = self.height;
} else {
self.measuredHeight = self.height;
height = targetSize.height;
}
[self measureContent:CGSizeMake(
self.measuredWidth - self.paddingLeft - self.paddingRight,
self.measuredHeight - self.paddingTop - self.paddingBottom)];
width - self.paddingLeft - self.paddingRight,
height - self.paddingTop - self.paddingBottom)];
BOOL needRemeasure = NO;
if (self.maxWidth >= 0) {
@@ -168,10 +174,18 @@ - (void)setFrame {
[obj.doricLayout setFrame];
}];
}
self.view.width = self.measuredWidth;
self.view.height = self.measuredHeight;
self.view.x = self.measuredX;
self.view.y = self.measuredY;
if (self.view.width != self.measuredWidth) {
self.view.width = self.measuredWidth;
}
if (self.view.height != self.measuredHeight) {
self.view.height = self.measuredHeight;
}
if (self.view.x != self.measuredX) {
self.view.x = self.measuredX;
}
if (self.view.y != self.measuredY) {
self.view.y = self.measuredY;
}
}
- (void)measureUndefinedContent:(CGSize)targetSize {
@@ -193,7 +207,6 @@ - (void)measureUndefinedContent:(CGSize)targetSize {
} else {
self.measuredHeight = measuredSize.height + self.paddingTop + self.paddingBottom;
}
}
}