当我在模拟器上运行它工作正常。但是,当我在物理设备上运行,我遇到一个错误 - index out of range
。
代码:scrollToItem UICollectionView错误 - 索引超出范围
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let index = NSIndexPath(row: 0, section: 0) as IndexPath
resultController?.collectionView?.scrollToItem(at: index, at: .bottom, animated: true)
}
P.S:我想UICollectionView
滚动到顶部,当我点击。
错误发生,为什么你尝试做什么? – Honey
我收到类似的问题。你能解决这个问题吗?你如何能够确定问题将在何处形成? – user805981