LXReorderableCollectionViewFlowLayout icon indicating copy to clipboard operation
LXReorderableCollectionViewFlowLayout copied to clipboard

adding a trash can in bottom of view in order to delete items

Open roiholtzman opened this issue 9 years ago • 3 comments

Is there a way to add a trash can at the bottom of the view so that when an item is being dragged on it, the item will be deleted from the array? Thanks for the help.

roiholtzman avatar Nov 21 '14 16:11 roiholtzman

Unfortunately, currently this library doesn't do that out of the box, but technically you can achieve it with some modifications.

lxcid avatar Nov 21 '14 16:11 lxcid

Can you maybe give me a pointer on what to do?

roiholtzman avatar Nov 21 '14 17:11 roiholtzman

https://github.com/lxcid/LXReorderableCollectionViewFlowLayout/blob/master/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m#L149-L150

These 2 lines query the collection view for the index the current selection is over on, what you could do is before this query, see if you are over trash can. If you are, you might want to update the collection view state to reflect the changes. If not, just let the system continue to manage the reordering behavior. You probably want to expands the delegate system to keep your codebase clean, unless those behaviour are general enough.

Note that this is a pretty tight loop so keep thing short. :)

lxcid avatar Nov 21 '14 17:11 lxcid