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 = it.view;
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
[self.view.contentView.doricLayout apply:self.view.frame.size];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)blendHeader {
|
- (void)blendHeader {
|
||||||
@ -137,7 +136,13 @@ - (void)blendHeader {
|
|||||||
self.view.headerView = it.view;
|
self.view.headerView = it.view;
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)requestLayout {
|
||||||
[self.view.headerView.doricLayout apply:self.view.frame.size];
|
[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 {
|
- (void)blendSubNode:(NSDictionary *)subModel {
|
||||||
|
@ -77,6 +77,14 @@ - (void)setHeaderView:(UIView *)headerView {
|
|||||||
self.refreshable = YES;
|
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 {
|
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
|
||||||
if (-scrollView.contentOffset.y >= self.headerView.height) {
|
if (-scrollView.contentOffset.y >= self.headerView.height) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
@ -83,19 +83,25 @@ - (void)apply {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)measure:(CGSize)targetSize {
|
- (void)measure:(CGSize)targetSize {
|
||||||
|
CGFloat width;
|
||||||
|
CGFloat height;
|
||||||
if (self.widthSpec == DoricLayoutMost) {
|
if (self.widthSpec == DoricLayoutMost) {
|
||||||
self.measuredWidth = targetSize.width;
|
width = self.measuredWidth = targetSize.width;
|
||||||
|
} else if (self.widthSpec == DoricLayoutJust) {
|
||||||
|
width = self.measuredWidth = self.width;
|
||||||
} else {
|
} else {
|
||||||
self.measuredWidth = self.width;
|
width = targetSize.width;
|
||||||
}
|
}
|
||||||
if (self.heightSpec == DoricLayoutMost) {
|
if (self.heightSpec == DoricLayoutMost) {
|
||||||
self.measuredHeight = targetSize.height;
|
height = self.measuredHeight = targetSize.height;
|
||||||
|
} else if (self.heightSpec == DoricLayoutJust) {
|
||||||
|
height = self.measuredHeight = self.height;
|
||||||
} else {
|
} else {
|
||||||
self.measuredHeight = self.height;
|
height = targetSize.height;
|
||||||
}
|
}
|
||||||
[self measureContent:CGSizeMake(
|
[self measureContent:CGSizeMake(
|
||||||
self.measuredWidth - self.paddingLeft - self.paddingRight,
|
width - self.paddingLeft - self.paddingRight,
|
||||||
self.measuredHeight - self.paddingTop - self.paddingBottom)];
|
height - self.paddingTop - self.paddingBottom)];
|
||||||
|
|
||||||
BOOL needRemeasure = NO;
|
BOOL needRemeasure = NO;
|
||||||
if (self.maxWidth >= 0) {
|
if (self.maxWidth >= 0) {
|
||||||
@ -168,10 +174,18 @@ - (void)setFrame {
|
|||||||
[obj.doricLayout setFrame];
|
[obj.doricLayout setFrame];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
if (self.view.width != self.measuredWidth) {
|
||||||
self.view.width = self.measuredWidth;
|
self.view.width = self.measuredWidth;
|
||||||
|
}
|
||||||
|
if (self.view.height != self.measuredHeight) {
|
||||||
self.view.height = self.measuredHeight;
|
self.view.height = self.measuredHeight;
|
||||||
|
}
|
||||||
|
if (self.view.x != self.measuredX) {
|
||||||
self.view.x = self.measuredX;
|
self.view.x = self.measuredX;
|
||||||
|
}
|
||||||
|
if (self.view.y != self.measuredY) {
|
||||||
self.view.y = self.measuredY;
|
self.view.y = self.measuredY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)measureUndefinedContent:(CGSize)targetSize {
|
- (void)measureUndefinedContent:(CGSize)targetSize {
|
||||||
@ -193,7 +207,6 @@ - (void)measureUndefinedContent:(CGSize)targetSize {
|
|||||||
} else {
|
} else {
|
||||||
self.measuredHeight = measuredSize.height + self.paddingTop + self.paddingBottom;
|
self.measuredHeight = measuredSize.height + self.paddingTop + self.paddingBottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user