Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UICollectionView cell can't be selected after reload in case if cell was touched during reloading

I use UICollectionView to display server-related information. This UICollectionView allows cells selection to display some nested data. Unfortunately if user touches and holds any cells during my app calls [collectionView reloadData] this cell doesn't react on touches anymore (collectionView:didSelectItemAtIndexPath: method isn't called). I can select any cells except this one.

I created simple application that can reproduce this problem: link

Any ideas how to fix it?

like image 855
Vitaly S. Avatar asked May 29 '14 18:05

Vitaly S.


1 Answers

Looks like a bug (I believe there is a similar issue where a cell.selected = YES without a -selectItemAtIndexPath:animated:scrollPosition: caused the cell to be unable to be unselected)

However if you do this:

[self.collectionView reloadItemsAtIndexPaths:[self.collectionView indexPathsForVisibleItems]];

instead of [self.collectionView reloadData] it is working as expected.

Update: Found the answer of the issue mentioned above

Another Update: It appears that this indeed was a bug. Tested the original project on the iOS8 simulator and the issue now is resolved.

like image 70
Alladinian Avatar answered Oct 31 '22 08:10

Alladinian