iOS:fix Refreshable
This commit is contained in:
parent
b17ff48c59
commit
5babfb4c9c
@ -100,7 +100,6 @@ - (void)blendContent {
|
||||
self.view.contentView = it.view;
|
||||
}];
|
||||
}
|
||||
[self.view.contentView.doricLayout apply:self.view.frame.size];
|
||||
}
|
||||
|
||||
- (void)blendHeader {
|
||||
@ -137,7 +136,13 @@ - (void)blendHeader {
|
||||
self.view.headerView = it.view;
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)requestLayout {
|
||||
[self.view.headerView.doricLayout apply:self.view.frame.size];
|
||||
self.view.headerView.bottom = 0;
|
||||
self.view.headerView.centerX = self.view.width / 2;
|
||||
[self.view.contentView.doricLayout apply:self.view.frame.size];
|
||||
}
|
||||
|
||||
- (void)blendSubNode:(NSDictionary *)subModel {
|
||||
|
@ -77,6 +77,14 @@ - (void)setHeaderView:(UIView *)headerView {
|
||||
self.refreshable = YES;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
if (self.contentOffset.y != 0) {
|
||||
return;
|
||||
}
|
||||
self.contentSize = self.frame.size;
|
||||
}
|
||||
|
||||
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
|
||||
if (-scrollView.contentOffset.y >= self.headerView.height) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user