Created
May 27, 2011 20:00
-
-
Save danielwestendorf/996043 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tableView(aView, acceptDrop:info, row:droppedRow, dropOperation:op) | |
pboard = info.draggingPasteboard | |
row_data_array = YAML.load(pboard.stringForType("MyRowDataType")) #grab the YAML from the pasteboard and convert it back to an array | |
row_data_array.reverse.each do |row| #You'll want to insert your rows in reverse order to maintain the indexes, thus the reverse call | |
#rearrange your table_data_array accordingly here. droppedRow represents index value of where the row was dropped. | |
end | |
table_view.deselectAll(nil) #Deselect everything after the drop | |
table_view.reloadData #redraw the table to show the updates | |
return true #if everything went as planned, return true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment