如何解决在集合视图中删除单元格后立即选择单元格
如何获取集合视图中已删除单元格旁边项目的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 举报,一经查实,本站将立刻删除。