I\'ve got a simple, single-column, view-based NSTableView with items in it that can be dragged to reorder them. During drag and drop, I\'d like to make it so that a gap for the
One way to accomplish what you're asking is to insert an empty row at the proposed drop point (that is, between the two nearest rows). It sounds like you've been looking at using NSTableViewAnimationEffectGap
, which as you note is really meant for animating the insertion when the drop is accepted in -tableView:acceptDrop:row:dropOperation:
.
Since you want to open up the gap before the user releases the mouse button to actually do the drop, you could instead insert a blank row using -insertRowsAtIndexes:withAnimation:
from your table's -draggingUpdate:
method and at the same time delete any blank row you previously inserted for this drag using -removeRowsAtIndexes:withAnimation:
. Use NSTableViewAnimationSlideUp
and NSTableViewAnimationSlideDown
as the animations for these operations, as appropriate.