I have multiple items in a CollectionView, but only a few of them should be selectable. I'm handling this with the delegate method:
- (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath
My problem occurs if a selectable item is selected and in the next step the selection of a not selectable item is rejected by shouldSelectItemAtIndexPath returning NO, the selected item gets deselected anyway.
I have also tried to use
- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath
But it's the same problem.
Is this the correct desired behaviour of UICollectionView? And if yes, how can i avoid the deselection of my last selected item if a not selectable item gets selected?