I want to change the image used when I drag an item from a view- and datasource-based NSOutlineView
, but can't seem to find a hook. I've tried modifying
- (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag
in the rowViews, in the tableCellViews, and in a subclass of NSOutlineView
itself, but to no avail.
Does anyone know where the default image (it's obviously taken from the tableCellView's image and textfield) is coming from?
It's slightly awkward:
From your data source you can set the images on the
NSDraggingSession
instance you're passed via parameger e.g. totableView:draggingSession:willBeginAtPoint:forRowIndexes:
.You can then use the
enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock:
method on theNSDraggingSession
instance to change the actual drag images of yourNSDraggingItems
: