I've just wasted entire evening chasing bunch of wierd (non)bugs trying to accept files (NSFilenamesPboardType
) dropped onto NSTableView
.
The bad news is NSDraggingDestination
protocol doesn't work for this. The good news is that you don't need it. It works even without subclassing!
Just call setDelegate:yourobject
and registerForDraggedTypes
on NSTableView
and implement these two methods in your delegate:
– (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)operation
– (NSDragOperation)tableView:(NSTableView *)tableView
validateDrop:(id <NSDraggingInfo>)info
proposedRow:(int)row
proposedDropOperation:(NSTableViewDropOperation)operation
Oh, and those ugly black borders/lines can't be removed without hacks.