我正在调用此方法,nextCellIndexPath是一个大于当前单元格的indexPath,但indexPath未正确递增。如何增加UICollectionView的NSIndexPath
这里是cellForItemAtIndexPath:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("collectionViewCell", forIndexPath: indexPath) as! ImageCollectionViewCell
cell.nextCellIndexPath = indexPath.indexPathByAddingIndex(1)
return cell
}
当我试图滚动到下一个indexPath,看来该indexPath不会增加。
那么如何正确获取下一个indexPath呢?
它看起来就像你分配'nextCell'是一个'NSIndexPath'实例,而不是一个细胞,是正确的? – Dash
正确。我可能应该重命名它。 –
当您调用滚动时,该项目是否已在屏幕上可见?我认为只有当物品不完全可见时才会滚动。 – Dash