My app has an array of file paths contained in a subclass of NSTableView, I would like to be able to drag those files (and folders) from my app to other applications.
I followed this article: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/Tasks/UsingDragAndDrop.html
but it didn't work. This one: http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/DragandDrop/Tasks/DraggingFiles.html#//apple_ref/doc/uid/20001288-CEGJFDFG , using the 1st method (mouseDown and performDragOperation) kind of worked but something like mouseDragged would have been much better.I have down开发者_运维百科loaded and looked at the DragNDropOutlineView example but I didn't find what I wanted (they are dragging file promises).
What am I missing?
Thank you.
EDIT: I eventually managed to do that. I followed the instruction on the 1st link (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/Tasks/UsingDragAndDrop.html) but I had to add the following lines in my awakeFromNib method to make it work:
[resultTable setDraggingSourceOperationMask:NSDragOperationNone forLocal:YES];
[resultTable setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO];
resultTable being the instance of my subclass of NSTableView.
精彩评论