feat:iOS Slider paging effect

This commit is contained in:
pengfei.zhou 2019-11-19 18:07:38 +08:00
parent f2d2c96619
commit 27db7f45fb

View File

@ -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