diff --git a/doric-iOS/Pod/Classes/Doric.h b/doric-iOS/Pod/Classes/Doric.h index 57b4bf3b..f7e6fc66 100644 --- a/doric-iOS/Pod/Classes/Doric.h +++ b/doric-iOS/Pod/Classes/Doric.h @@ -28,4 +28,5 @@ #import "DoricPromise.h" #import "DoricLibrary.h" #import "DoricNativePlugin.h" -#import "DoricMonitorProtocol.h" \ No newline at end of file +#import "DoricMonitorProtocol.h" +#import "DoricScrollViewDelegate.h" \ No newline at end of file diff --git a/doric-iOS/Pod/Classes/DoricScrollViewDelegate.h b/doric-iOS/Pod/Classes/DoricScrollViewDelegate.h new file mode 100644 index 00000000..c5539b49 --- /dev/null +++ b/doric-iOS/Pod/Classes/DoricScrollViewDelegate.h @@ -0,0 +1,9 @@ +// +// Created by pengfei.zhou on 2020/2/13. +// + +#import + +@protocol DoricScrollViewDelegate +- (void)scrollViewDidScroll:(UIScrollView *)scrollView; +@end \ No newline at end of file diff --git a/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.h b/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.h index 53cd9a39..368a6516 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.h +++ b/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.h @@ -19,6 +19,8 @@ #import #import "DoricSuperNode.h" +#import "DoricScrollViewDelegate.h" @interface DoricFlowLayoutNode : DoricSuperNode +@property(nonatomic, weak, nullable) id delegate; @end \ No newline at end of file diff --git a/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m b/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m index 81079cc9..29db154f 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m @@ -369,4 +369,7 @@ - (NSInteger)doricFlowLayoutColumnCount { return self.columnCount; } +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { + [self.delegate scrollViewDidScroll:scrollView]; +} @end diff --git a/doric-iOS/Pod/Classes/Shader/DoricListNode.h b/doric-iOS/Pod/Classes/Shader/DoricListNode.h index 97244086..68190d7b 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricListNode.h +++ b/doric-iOS/Pod/Classes/Shader/DoricListNode.h @@ -19,6 +19,8 @@ #import #import "DoricSuperNode.h" +#import "DoricScrollViewDelegate.h" @interface DoricListNode : DoricSuperNode +@property(nonatomic, weak, nullable) id delegate; @end \ No newline at end of file diff --git a/doric-iOS/Pod/Classes/Shader/DoricListNode.m b/doric-iOS/Pod/Classes/Shader/DoricListNode.m index 98d4bd41..8376b9e3 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricListNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricListNode.m @@ -249,4 +249,7 @@ - (DoricViewNode *)subNodeWithViewId:(NSString *)viewId { return ret; } +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { + [self.delegate scrollViewDidScroll:scrollView]; +} @end diff --git a/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.h b/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.h index ec8a2253..18c46d91 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.h +++ b/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.h @@ -21,10 +21,12 @@ // #import #import "DoricSuperNode.h" +#import "DoricScrollViewDelegate.h" @interface DoricScrollView : UIScrollView @property(nonatomic, strong) UIView *contentView; @end @interface DoricScrollerNode : DoricSuperNode +@property(nonatomic, weak, nullable) id delegate; @end \ No newline at end of file diff --git a/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.m b/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.m index 733445c8..474de0f4 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricScrollerNode.m @@ -47,7 +47,7 @@ - (void)layoutSelf:(CGSize)targetSize { @end -@interface DoricScrollerNode () +@interface DoricScrollerNode () @property(nonatomic, strong) DoricViewNode *childNode; @property(nonatomic, copy) NSString *childViewId; @end @@ -55,6 +55,7 @@ @interface DoricScrollerNode () @implementation DoricScrollerNode - (DoricScrollView *)build { return [[DoricScrollView new] also:^(DoricScrollView *it) { + it.delegate = self; if (@available(iOS 11, *)) { it.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; } @@ -123,4 +124,7 @@ - (DoricViewNode *)subNodeWithViewId:(NSString *)viewId { } return nil; } +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { + [self.delegate scrollViewDidScroll:scrollView]; +} @end