Cocoa: Create draggable zones
How can I create draggable zones in cocoa an开发者_开发技巧d be able to drag and drop images between the two.
Ex:
Zone 1:no image
Zone 2:image
drag zone 2's image to zone 1, and be able to save (core data) the location of the image.
Would I have to do something like this: http://developer.apple.com/Mac/library/documentation/Cocoa/Conceptual/DragandDrop/DragandDrop.html ?
Yes, you've answered your own question. You need to implement the various protocols that are described in the documentation you referenced.
You could just use two NSImageView
objects and make them editable. Editable NSImageView
objects allow drag and drop by default.
However, NSImageView
doesn't store information about the location of the image in the file system. If you need that information you would need to implement your own view/control.
精彩评论