feature:CoordinateLayout support multi set

This commit is contained in:
pengfei.zhou
2020-03-10 17:23:55 +08:00
committed by osborn
parent eceb7b9567
commit 01d736c5a6
12 changed files with 106 additions and 28 deletions

View File

@@ -53,6 +53,7 @@ @interface DoricScrollerNode () <UIScrollViewDelegate>
@property(nonatomic, copy) NSString *childViewId;
@property(nonatomic, copy) NSString *onScrollFuncId;
@property(nonatomic, copy) NSString *onScrollEndFuncId;
@property(nonatomic, strong) NSMutableSet <DoricDidScrollBlock> *didScrollBlocks;
@end
@implementation DoricScrollerNode
@@ -139,8 +140,8 @@ - (DoricViewNode *)subNodeWithViewId:(NSString *)viewId {
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (self.didScrollListener) {
self.didScrollListener(scrollView);
for (DoricDidScrollBlock block in self.didScrollBlocks) {
block(scrollView);
}
if (self.onScrollFuncId) {
[self callJSResponse:self.onScrollFuncId,
@@ -192,4 +193,20 @@ - (void)scrollBy:(NSDictionary *)params {
MIN(self.view.contentSize.height - self.view.height, MAX(0, offset.y + self.view.contentOffset.y)))
animated:animated];
}
- (NSMutableSet<DoricDidScrollBlock> *)didScrollBlocks {
if (!_didScrollBlocks) {
_didScrollBlocks = [NSMutableSet new];
}
return _didScrollBlocks;
}
- (void)addDidScrollBlock:(__nonnull DoricDidScrollBlock)didScrollListener {
[self.didScrollBlocks addObject:didScrollListener];
}
- (void)removeDidScrollBlock:(__nonnull DoricDidScrollBlock)didScrollListener {
[self.didScrollBlocks removeObject:didScrollListener];
}
@end