當我在模擬器上運行它工作正常。但是,當我在物理設備上運行,我遇到一個錯誤 - 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