UICollectionView deselect previous cell

2852 views ios

I have a UICollectionView with horizontal scrolling. I highlight a cell that user selects by having a different border color. When the user selects another cell, I wish to deselect the previous one (which may or may not be visible). The way I solved it previously is by reloading collection view. But in the current use case, it creates a flicker as I reload collection view and scroll to selected item. What is the correct approach here?

answered question

1 Answer


You can reload that single cell, that needs to become deselected, by calling reloadItems(at: [IndexPath]).

posted this

Have an answer?


Please login first before posting an answer.