feat:Scroller add scrollTo method

This commit is contained in:
pengfei.zhou
2020-03-03 13:10:35 +08:00
committed by osborn
parent 2927ad5679
commit 46255632ec
12 changed files with 92 additions and 11 deletions

View File

@@ -22,6 +22,7 @@
#import "DoricScrollerNode.h"
#import "DoricExtensions.h"
#import "DoricRefreshableNode.h"
#import "DoricPromise.h"
@implementation DoricScrollView
@@ -132,4 +133,11 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
self.didScrollListener(scrollView);
}
}
- (void)scrollTo:(NSDictionary *)params {
BOOL animated = [params[@"animated"] boolValue];
NSDictionary *offsetDic = params[@"offset"];
CGPoint offset = CGPointMake([offsetDic[@"x"] floatValue], [offsetDic[@"y"] floatValue]);
[self.view setContentOffset:offset animated:animated];
}
@end