UICollectionView how to deselect all

后端 未结 6 2273
被撕碎了的回忆
被撕碎了的回忆 2021-02-12 23:26

I have a FollowVC and FollowCell Setup with collection View. I can display all the datas correctly into my uIcollection view cell using the following code with no problem.

6条回答
  •  萌比男神i
    2021-02-12 23:46

    Using Extension in Swift 4

    extension UICollectionView {
    
        func deselectAllItems(animated: Bool) {
            guard let selectedItems = indexPathsForSelectedItems else { return }
            for indexPath in selectedItems { deselectItem(at: indexPath, animated: animated) }
        }
    }
    

提交回复
热议问题