Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've implemented <a href="http://ice3-software.github.io/between-kit/" rel="nofollow">a solution</a> to this before.</p> <h3>Approach</h3> <ul> <li>The main component of the solution is class that listens for drag / drop events and broadcasts them to a delegate; I called this component the <code>gesture coordinator</code>. It handles the events emitted from a <code>UIGestureRecognizer</code> to calculate the 'drag and drop' state and notify the delegate. </li> <li>For example, a view controller acting as its delegate would receive messages about when items have been exchanged between collections and then update its collection views and data sources.</li> <li>The gesture coordinator is essentially just a drag-and-drop decorator for a <code>UIGestureRecognizer</code>.</li> </ul> <h3>Gesture Coordinator Logic</h3> <p>Here are the propositions that I considered when implementing the gesture coordinator: </p> <blockquote> <ul> <li>A collection is a view that contains and array of child items.</li> <li>A drag arena consists of a superview and an ordered set of collections that exist as subviews within that superview.</li> <li>The order of the collections in the drag arena determines their drag / drop priority. That is, if a collection sits at the beginning of the drag arena's ordered set of collections, then drags and drops occurring on that collection will be recognized in place of any of the later collections in the set.</li> <li>A drag starts if and only if a gesture is started within the bounds of a draggable item of a collection in the drag arena. Dragging occurs if and only if, immediately after a drag has been started, the location of the gesture changes within the drag arena.</li> <li>A drag stops if and only if immediately after dragging the gesture stops, is cancelled or finishes.</li> <li>A deletion occurs if and only if the drag stops at a point which is specified as being deletable. For example, the user may designate certain bounds within the drag arena to be 'delete on drop' areas.</li> <li>A rearrange occurs if and only if the drag stops within the bounds of the collection that it started in, on a different item in that collection which is specified as being rearrangeable, and on a point in the drag arena that is not specified as being deletable.</li> <li>A drop occurs if and only if the drag stops within the bounds of another collection in the drag arena, on a specific item or point that is specified as droppable within that collection, and on a point in the drag arena which is not specified as being deletable.</li> </ul> </blockquote> <h3>References</h3> <ul> <li><a href="https://github.com/ice3-software/between-kit/tree/master/Docs" rel="nofollow">Documentation</a></li> <li><a href="https://github.com/ice3-software/between-kit/tree/master/Use%20Cases" rel="nofollow">Use Case examples</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload