Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag & Drop between two UICollectionViews

I need to drag a Cell from CollectionView One and drop it to CollectionView Two. The Drag & Drop inside one CollectionView is no Problem, but how can i get the Cell out of CollectionView One to CollectionView Two?

Any ideas? Any projects or frameworks that have already solved this problem? Thanks for helping!

like image 980
Werewolve Avatar asked Jul 02 '13 14:07

Werewolve


2 Answers

https://github.com/Ice3SteveFortune/i3-dragndrop Check this out - its a helper I'm working on to achieve just that. It also supports tableviews

UPDATE

I've recently released the second version of this codebase, called BetweenKit. Its now a fully-fledged drag-and-drop framework.

Hope it proves useful !

like image 77
sf13579 Avatar answered Sep 19 '22 05:09

sf13579


When you select the cell from the first collection view, remove it from this collection view, create a new view as copy of that cell place it as subview of the superview on top of all views. Make that view movable using pan gestures. As soon as you "drop" this intermediary cell, detect its position and add it to the current collection view.

like image 29
Martin Mandl Avatar answered Sep 23 '22 05:09

Martin Mandl