lukescott / DraggableCollectionView

Extension for the UICollectionView and UICollectionViewLayout that allows a user to move items with drag and drop. --- HELP WANTED --- Looking for maintainer and help with the experimental branch.
MIT License
549 stars 175 forks source link

Use `indexPathForItemAtPoint:` for long press. #54

Open pbernery opened 9 years ago

pbernery commented 9 years ago

handleLongPressGesture: was using indexPathForItemClosestToPoint: method to retrieve the index path of the pressed cell. This works well on layouts that fill the entire collection view space but not on other layouts: in the latter case, the closest cell will be selected whereas this is the one under the finger we want to be selected.

It now uses indexPathForItemAtPoint: instead of indexPathForItemClosestToPoint: to get the touched cell.

An by the way, your lib is awesome: I added dragging in a complex layout in a couple of hours.