Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
roiholtzman opened this issue Nov 21, 2014 · 3 comments
Open

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

roiholtzman opened this issue Nov 21, 2014 · 3 comments

Comments

@roiholtzman
Copy link

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.

@lxcid
Copy link
Owner

lxcid commented Nov 21, 2014

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

@roiholtzman
Copy link
Author

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

@lxcid
Copy link
Owner

lxcid commented Nov 21, 2014

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. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants