【发布时间】:2018-07-06 12:24:13
【问题描述】:
我有一个集合视图,其中每个单元格都有图像。我需要在集合视图上执行自动滚动,但不知道如何操作?
附: - 需要知道目标中的实现 - c
【问题讨论】:
标签: ios objective-c iphone uicollectionview autoscroll
我有一个集合视图,其中每个单元格都有图像。我需要在集合视图上执行自动滚动,但不知道如何操作?
附: - 需要知道目标中的实现 - c
【问题讨论】:
标签: ios objective-c iphone uicollectionview autoscroll
你可以使用scrollview方法来做到这一点
快速
collectionView.scrollToItem(at: IndexPath.init(item: item, section: section), at: UICollectionViewScrollPosition, animated: true)
针对目标 c
[self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:indexpathofitem inSection:section]
atScrollPosition:UICollectionViewScrollPosition
animated:YES];
【讨论】:
你可以试试这个
[self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]
atScrollPosition:UICollectionViewScrollPositionBottom
animated:YES];
//
在每 1 秒滴答一次的计时器内
[self.collectionView setContentOffset:CGPointMake(0,yValue)];
【讨论】: