diff --git a/iOS/Pod/Classes/Refresh/DoricSwipeRefreshLayout.m b/iOS/Pod/Classes/Refresh/DoricSwipeRefreshLayout.m index f92c0c9f..f5a4bf88 100644 --- a/iOS/Pod/Classes/Refresh/DoricSwipeRefreshLayout.m +++ b/iOS/Pod/Classes/Refresh/DoricSwipeRefreshLayout.m @@ -5,7 +5,6 @@ #import "DoricSwipeRefreshLayout.h" #import "UIView+Doric.h" #import "DoricLayouts.h" -#import "Doric.h" @interface DoricSwipeRefreshLayout () @@ -40,9 +39,18 @@ - (CGSize)sizeThatFits:(CGSize)size { return CGSizeZero; } +- (BOOL)requestFromSubview:(UIView *)subview { + if (subview == self.headerView) { + return NO; + } + return [super requestFromSubview:subview]; +} + - (void)layoutSelf:(CGSize)targetSize { [super layoutSelf:targetSize]; - [self.contentView layoutSelf:targetSize]; + self.headerView.bottom = 0; + self.headerView.centerX = self.centerX; + self.contentSize = self.frame.size; } - (void)setContentView:(UIView *)contentView { diff --git a/iOS/Pod/Classes/Shader/DoricLayouts.h b/iOS/Pod/Classes/Shader/DoricLayouts.h index 86824f3c..fcddee0c 100644 --- a/iOS/Pod/Classes/Shader/DoricLayouts.h +++ b/iOS/Pod/Classes/Shader/DoricLayouts.h @@ -94,4 +94,6 @@ typedef NS_ENUM(NSInteger, DoricGravity) { - (CGSize)measureSize:(CGSize)targetSize; - (void)doricLayoutSubviews; + +- (BOOL)requestFromSubview:(UIView *)subview; @end \ No newline at end of file diff --git a/iOS/Pod/Classes/Shader/DoricLayouts.m b/iOS/Pod/Classes/Shader/DoricLayouts.m index 72214e07..d1584848 100644 --- a/iOS/Pod/Classes/Shader/DoricLayouts.m +++ b/iOS/Pod/Classes/Shader/DoricLayouts.m @@ -101,20 +101,23 @@ - (void)layoutSelf:(CGSize)targetSize { } } -- (BOOL)requestSuperview { - return self.layoutConfig - && self.layoutConfig.widthSpec != DoricLayoutExact - && self.layoutConfig.heightSpec != DoricLayoutExact; -} - (void)doricLayoutSubviews { - if ([self requestSuperview]) { + if ([self.superview requestFromSubview:self]) { [self.superview doricLayoutSubviews]; } else { [self layoutSelf:CGSizeMake(self.width, self.height)]; } } +- (BOOL)requestFromSubview:(UIView *)subview { + if (self.layoutConfig + && self.layoutConfig.widthSpec != DoricLayoutExact + && self.layoutConfig.heightSpec != DoricLayoutExact) { + return YES; + } + return NO; +} @end DoricMargin DoricMarginMake(CGFloat left, CGFloat top, CGFloat right, CGFloat bottom) {