iOS:add ScrollViewDelegate for scroller,list and flowlayout
This commit is contained in:
parent
9086b6b13d
commit
565998c763
@ -28,4 +28,5 @@
|
|||||||
#import "DoricPromise.h"
|
#import "DoricPromise.h"
|
||||||
#import "DoricLibrary.h"
|
#import "DoricLibrary.h"
|
||||||
#import "DoricNativePlugin.h"
|
#import "DoricNativePlugin.h"
|
||||||
#import "DoricMonitorProtocol.h"
|
#import "DoricMonitorProtocol.h"
|
||||||
|
#import "DoricScrollViewDelegate.h"
|
9
doric-iOS/Pod/Classes/DoricScrollViewDelegate.h
Normal file
9
doric-iOS/Pod/Classes/DoricScrollViewDelegate.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Created by pengfei.zhou on 2020/2/13.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@protocol DoricScrollViewDelegate <NSObject>
|
||||||
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
|
||||||
|
@end
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "DoricSuperNode.h"
|
#import "DoricSuperNode.h"
|
||||||
|
#import "DoricScrollViewDelegate.h"
|
||||||
|
|
||||||
@interface DoricFlowLayoutNode : DoricSuperNode<UICollectionView *>
|
@interface DoricFlowLayoutNode : DoricSuperNode<UICollectionView *>
|
||||||
|
@property(nonatomic, weak, nullable) id <DoricScrollViewDelegate> delegate;
|
||||||
@end
|
@end
|
@ -369,4 +369,7 @@ - (NSInteger)doricFlowLayoutColumnCount {
|
|||||||
return self.columnCount;
|
return self.columnCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||||
|
[self.delegate scrollViewDidScroll:scrollView];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "DoricSuperNode.h"
|
#import "DoricSuperNode.h"
|
||||||
|
#import "DoricScrollViewDelegate.h"
|
||||||
|
|
||||||
@interface DoricListNode : DoricSuperNode<UITableView *>
|
@interface DoricListNode : DoricSuperNode<UITableView *>
|
||||||
|
@property(nonatomic, weak, nullable) id <DoricScrollViewDelegate> delegate;
|
||||||
@end
|
@end
|
@ -249,4 +249,7 @@ - (DoricViewNode *)subNodeWithViewId:(NSString *)viewId {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||||
|
[self.delegate scrollViewDidScroll:scrollView];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -21,10 +21,12 @@
|
|||||||
//
|
//
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "DoricSuperNode.h"
|
#import "DoricSuperNode.h"
|
||||||
|
#import "DoricScrollViewDelegate.h"
|
||||||
|
|
||||||
@interface DoricScrollView : UIScrollView
|
@interface DoricScrollView : UIScrollView
|
||||||
@property(nonatomic, strong) UIView *contentView;
|
@property(nonatomic, strong) UIView *contentView;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface DoricScrollerNode : DoricSuperNode<DoricScrollView *>
|
@interface DoricScrollerNode : DoricSuperNode<DoricScrollView *>
|
||||||
|
@property(nonatomic, weak, nullable) id <DoricScrollViewDelegate> delegate;
|
||||||
@end
|
@end
|
@ -47,7 +47,7 @@ - (void)layoutSelf:(CGSize)targetSize {
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface DoricScrollerNode ()
|
@interface DoricScrollerNode () <UIScrollViewDelegate>
|
||||||
@property(nonatomic, strong) DoricViewNode *childNode;
|
@property(nonatomic, strong) DoricViewNode *childNode;
|
||||||
@property(nonatomic, copy) NSString *childViewId;
|
@property(nonatomic, copy) NSString *childViewId;
|
||||||
@end
|
@end
|
||||||
@ -55,6 +55,7 @@ @interface DoricScrollerNode ()
|
|||||||
@implementation DoricScrollerNode
|
@implementation DoricScrollerNode
|
||||||
- (DoricScrollView *)build {
|
- (DoricScrollView *)build {
|
||||||
return [[DoricScrollView new] also:^(DoricScrollView *it) {
|
return [[DoricScrollView new] also:^(DoricScrollView *it) {
|
||||||
|
it.delegate = self;
|
||||||
if (@available(iOS 11, *)) {
|
if (@available(iOS 11, *)) {
|
||||||
it.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
it.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||||
}
|
}
|
||||||
@ -123,4 +124,7 @@ - (DoricViewNode *)subNodeWithViewId:(NSString *)viewId {
|
|||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||||
|
[self.delegate scrollViewDidScroll:scrollView];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user