我正在使用colletionview图像来水平滚动图像。我使用didselectitem从第一个集合视图中获取索引,并通过segue转换,使用所选的索引从第二个集合视图中的数组中挑选图像。
由于我使用的是ScrollToItem,当我点击image5时,它会在跳过前5张图片后跳到第6张图片。一切正常,但问题是,过渡并不顺利。我可以看到前5张图片滑动了几分之一秒,这并不酷。如何在滚动时获得无缝过渡?
发布于 2020-05-08 13:17:23
这对我在CollectionView中的平滑过渡(水平方向)很有效。请检查您的scrollToItem方法。
DispatchQueue.main.async {
let nextItem: IndexPath = IndexPath(item: 4, section: 0)
self.collectionCatlogue.scrollToItem(at: nextItem, at: .centeredHorizontally, animated: true)
}如果这些东西对你不起作用,请分享你的代码。
https://stackoverflow.com/questions/61671938
复制相似问题