iOS 获取scrollView将要 停止拖动的时候的目标便宜量, 实现抖音无缝播放效果

阅读 54

2022-02-12

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
-{   
	  /// 获取当前索引
	 NSInteger currentIndex = (*targetContentOffset).y/scrollView.bounds.size.height;
	 [self playTheVideoAtIndexPath:[NSIndexPath indexPathForRow:currentIndex inSection:0]];
}

精彩评论(0)

0 0 举报