问题描述
如何获取集合视图中已删除单元格旁边项目的indexPath。 我希望过程像这样: 选择特定的单元格(带有边框颜色)以将其删除,然后将其删除后,将选择下一个单元格(带有边框颜色) 我已经搜索了很多,但仍然不知道该怎么做 我知道我不应该尝试使用didSelectItemAt,因为它将在选择单元格后触发,因此在此过程中无济于事。 我已经尝试过了,但是也不起作用
if let selectedCells = self.collectionView.indexPathsForSelectedItems {
let items = selectedCells.map {$0.item}.sorted().reversed()
for item in items{
self.photosArr.remove(at: item)
}
self.collectionView.deleteItems(at: selectedCells)
let nextPath = NSIndexPath(row: selectedindexPath!.row + 1,section: 0)
self.collectionView.selectItem(at: nextPath as IndexPath,animated: true,scrollPosition: .centeredHorizontally)
self.collectionView.reloadData()
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)