MacRuby: NSTableView Drag’n Drop Rows

You have an NSTableView with an ordered list of data. Ordering that data is important to the user, and you want to implement drag ’n drop to rearrange the rows.

There are three methods you have to implement in your table delegate to get Drag ’n Drop to work.

Want to allow your rows to be dragged to other objects without accepting drops? Simple! Just implement the

tableView(myView, writeRowsWithIndexes:rowIndexes, toPasteBoard:pboard)
method.

Shablagoo!

rss