diff --git a/doric-iOS/Pod/Classes/Refresh/DoricRefreshableNode.m b/doric-iOS/Pod/Classes/Refresh/DoricRefreshableNode.m index 39bbcc81..68184df0 100644 --- a/doric-iOS/Pod/Classes/Refresh/DoricRefreshableNode.m +++ b/doric-iOS/Pod/Classes/Refresh/DoricRefreshableNode.m @@ -139,6 +139,7 @@ - (void)blendHeader { } - (void)requestLayout { + [self.contentNode requestLayout]; [self.view.headerView.doricLayout apply:self.view.frame.size]; self.view.headerView.bottom = 0; self.view.headerView.centerX = self.view.width / 2; diff --git a/doric-iOS/Pod/Classes/Shader/DoricGroupNode.h b/doric-iOS/Pod/Classes/Shader/DoricGroupNode.h index 202eb7c2..92125a86 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricGroupNode.h +++ b/doric-iOS/Pod/Classes/Shader/DoricGroupNode.h @@ -25,6 +25,8 @@ NS_ASSUME_NONNULL_BEGIN @interface DoricGroupNode : DoricSuperNode +@property(nonatomic, copy) NSArray *childNodes; +@property(nonatomic, copy) NSArray *childViewIds; @end NS_ASSUME_NONNULL_END diff --git a/doric-iOS/Pod/Classes/Shader/DoricGroupNode.m b/doric-iOS/Pod/Classes/Shader/DoricGroupNode.m index c5972287..a7389b1e 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricGroupNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricGroupNode.m @@ -22,11 +22,6 @@ #import "DoricGroupNode.h" -@interface DoricGroupNode () -@property(nonatomic, copy) NSArray *childNodes; -@property(nonatomic, copy) NSArray *childViewIds; -@end - @implementation DoricGroupNode - (instancetype)initWithContext:(DoricContext *)doricContext { diff --git a/doric-iOS/Pod/Classes/Shader/DoricListItemNode.m b/doric-iOS/Pod/Classes/Shader/DoricListItemNode.m index 1d15b543..9f4ff439 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricListItemNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricListItemNode.m @@ -36,6 +36,7 @@ - (void)initWithSuperNode:(DoricSuperNode *)superNode { } - (void)requestLayout { + [super requestLayout]; [self.view.doricLayout apply]; } @end diff --git a/doric-iOS/Pod/Classes/Shader/DoricNestedSliderNode.m b/doric-iOS/Pod/Classes/Shader/DoricNestedSliderNode.m index c9730795..d1e41ffe 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricNestedSliderNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricNestedSliderNode.m @@ -25,27 +25,6 @@ @interface DoricNestedSliderView : UIScrollView @end @implementation DoricNestedSliderView -//- (CGSize)sizeThatFits:(CGSize)size { -// if (self.subviews.count > 0) { -// CGFloat width = size.width; -// CGFloat height = size.height; -// for (UIView *child in self.subviews) { -// CGSize childSize = [child measureSize:size]; -// width = MAX(childSize.width, width); -// height = MAX(childSize.height, height); -// } -// return CGSizeMake(width, height); -// } -// return size; -//} -// -//- (void)layoutSelf:(CGSize)targetSize { -// [super layoutSelf:targetSize]; -// [self.subviews forEachIndexed:^(__kindof UIView *obj, NSUInteger idx) { -// obj.left = idx * self.width; -// }]; -// [self setContentSize:CGSizeMake(self.subviews.count * self.width, self.height)]; -//} @end @interface DoricNestedSliderNode () @@ -85,6 +64,13 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { self.lastPosition = pageIndex; } +- (void)requestLayout { + [self.childNodes forEachIndexed:^(DoricViewNode *node, NSUInteger idx) { + [node.view.doricLayout apply:self.view.frame.size]; + node.view.left = idx * self.view.width; + }]; + self.view.contentSize = CGSizeMake(self.childNodes.count * self.view.width, self.view.height); +} - (void)slidePage:(NSDictionary *)params withPromise:(DoricPromise *)promise { NSUInteger pageIndex = [params[@"page"] unsignedIntegerValue]; diff --git a/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.m b/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.m index e80e280b..1ba72072 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.m @@ -120,6 +120,7 @@ - (void)afterBlended:(NSDictionary *)props { } - (void)requestLayout { + [self.childNode requestLayout]; [self.view.contentView.doricLayout apply:self.view.frame.size]; }