0
votes

I have a UICollectionViewController with Pinch and LongPress gestures. The gesture's delegate is the UICollectionViewController.

When the view is loaded, if I select a cell, then didSelectItemAtIndexPath is called as expected.

But, if I then Pinch or "LongPress" a cell, now didSelectItemAtIndexPath isn't called anymore.

My temporary solution is to use a Tap gesture recognizer to replace the didSelectItemAtIndexPath, it works perfectly.

Isn't there a way to make didSelectItemAtIndexPath work? It just feels wrong to add a gesture for that when the UICollectionView already handles it.

Thanks

1

1 Answers

0
votes

Make sure before you add your gesture recognizers to you're view, make sure the boolean property "cancelTouchesInView" is set to false. This could be because the gesture is recognized so it ignores passing touches to the view causing the cell selection method not to be called. Link to property.