Question

I have a scroll view now. It has 2 images in each row. I wanna to add long press sorting for this view but I think its better to replace this scroll view with a collection view for easier sorting. I didn't find anything to learn how to sort a collection view with long press. I want users be able to long press each image and move it for sorting the images.

Appreciate any helps. Thanks.

Was it helpful?

Solution

You can use the method moveItemAtIndexPath:toIndexPath: for doing this. Here is the doc link. You just need to add a gesture recognizer to each cell and and call the method after you do the drop of the view.

You might want to write code to get the index path of source cell and destination cell though before calling the above method.

Also look towards the end of this doc page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top