Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With which method has Apple replaced "dragImage:"?

I have an app where I allow the user to drag/drop some data from an NSView, with a custom drag image under the cursor.

I just updated to the Xcode 6 beta, and now my drag/drop code won't compile. This is because Apple has deprecated the following NSView method:

dragImage:at:offset:event:pasteboard:source:slideBack:

Fine, but what am I supposed to use instead? All the Apple documentation I've found still merrily recommends the deprecated method.

There is also a "dragFile:" method, however my NSView represents AV data, and it's unsuitable to write a large new file to disk every time the user begins a drag. The user may well to abort the drag, possibly multiple times in rapid succession.

What is the new way to initiate a drag operation with a custom icon?

like image 520
original_username Avatar asked Nov 10 '22 05:11

original_username


1 Answers

Thanks to Kyle Sluder on Apple's Dev forums for alerting me to this. It turns out the replacement is

NSView beginDraggingSessionWithItems: event: source:

like image 171
original_username Avatar answered Nov 26 '22 02:11

original_username