-
(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
// 非加速中
if (!decelerate) {
[self checkCurrentSelect];
}
} -
(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
[self checkCurrentSelect];
} -
(void)checkCurrentSelect {
CGPoint cellPoint = [self.view convertPoint:self.clCollectionView.center toView:self.clCollectionView];
NSIndexPath *indexPath = [self.clCollectionView indexPathForItemAtPoint:cellPoint];
[_clCollectionView selectItemAtIndexPath:indexPath animated:true scrollPosition:UICollectionViewScrollPositionCenteredHorizontally];
self.currentIndexPath = indexPath;
}
网友评论