diff --git a/iOS/Pod/Classes/Shader/DoricSliderNode.m b/iOS/Pod/Classes/Shader/DoricSliderNode.m index 1ccf6cbc..540d457c 100644 --- a/iOS/Pod/Classes/Shader/DoricSliderNode.m +++ b/iOS/Pod/Classes/Shader/DoricSliderNode.m @@ -70,6 +70,7 @@ - (UICollectionView *)build { collectionViewLayout:flowLayout] also:^(UICollectionView *it) { it.backgroundColor = [UIColor whiteColor]; + it.pagingEnabled = YES; it.delegate = self; it.dataSource = self; [it registerClass:[DoricCollectionViewCell class] forCellWithReuseIdentifier:@"doricCell"]; @@ -181,4 +182,9 @@ - (void)blendSubNode:(NSDictionary *)subModel { }]; } } + +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { + NSUInteger pageIndex = (NSUInteger) (scrollView.contentOffset.x / scrollView.width); + scrollView.contentOffset = CGPointMake(pageIndex * scrollView.width, scrollView.contentOffset.y); +} @end