UICollectionView 取消全选

UICollectionView deselect all

使用 didSelectItemAtIndexPath 处理选择时,是否必须确保使用

cell.select = true

为了使 indexPathsForSelectedItems 正常工作?

我有一个集合视图,当在 "edit mode" 中选择时,我会在每个缩略图图像周围创建一个红色框。

cell?.backgroundColor = UIColor.redColor()

我想在按下 "DONE" 时清除那些框。

仅调用 indexPathsForSelectedItems returns 单个值,我不确定为什么? (我试过设置 cell=selected 但仍然只得到一个 return)。

在您的 collection 视图中将 allowsMultipleSelection 设置为 true。