Question

I've been searching online for a long time the answer to a question that has left me locked.

I have a subclassed NSView and want it to be draggable. When released into the desktop want to be saved as a file with the NSData that I have assigned (and also an extension that has been assigned).

I think I need to make the right call to:

[self dragImage:pic at:NSMakePoint(50, 50) offset:NSMakeSize(50, 50) event:theEvent pasteboard:pboard source:self slideBack:NO];

but I've been looking for hours and have not found anything to help me.

Was it helpful?

Solution

Have you tried using one of the file dragging methods on NSView?

- (BOOL)dragFile:(NSString *)filename fromRect:(NSRect)rect slideBack:(BOOL)aFlag event:(NSEvent *)event;
- (BOOL)dragPromisedFilesOfTypes:(NSArray *)typeArray fromRect:(NSRect)rect source:(id)sourceObject slideBack:(BOOL)aFlag event:(NSEvent *)event;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top