iOS 根据collectionView滑动距离计算出index
2020-12-25 本文已影响0人
冰点雨
//根据collectionView滑动距离计算出index
CGPoint p = CGPointMake(scrollView.contentOffset.x + CGRectGetWidth(scrollView.frame) / 2.0, CGRectGetHeight(scrollView.frame) / 2.0);
NSIndexPath *indexPath = [self.colloectView indexPathForItemAtPoint:p];