I want to drag a file from a NSTableView row to copy it to another application (i.e. Finder). I implemented the first two steps ('Configuring Your Table View', 'Beginning a Drag Operation') of this guide and thought that would do the trick: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/Tasks/UsingDragAndDrop.html
However, when I attempt to drag a row, the row text follows my mouse but the file does not copy when released. Here's what I'm sending to my UITableView upon initialization:
#define librarySongDataType @"NSFileContentsPboardType"
- (void)awakeFromNib
{
[self setDraggingSourceOperationMask:NSUIntegerMax forLocal:YES]; // allow interapplication drags
[self registerForDraggedTypes:[NSArray arrayWithObject:librarySongDataType] ]; // NSFileContentsPboardType
}
Here's how I'm handling the drag in my NSTableView's data source (an NSArrayController):
- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
{
NSLog(@"writeRowsWithIndexes");
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes];
[pboard setData:data forType:librarySongDataType];
return YES;
}
To be clear, I'm not trying to drag files into my table view, I'm just trying to drag file(s) out of it.
NSTableView.UITableViewis only on the iPhone. - d11wtq