On 9 Dec 2008, at 5:11 am, Gustavo Pizano wrote:

I have in a view images of ships, and Im able to drag them to another view which is the sea board, now, what is better, to create the objects of the ships in the "shipsviewcontainer" and set the object in the Pasteboard, or, just have representative images in the "shipsviewcontainer" of each ship, and once dragged to the sea create the instances of the ship that the images represent. If the last one is correct Iw as thinking if how to know which Ship Object the images that is being dragged represents, (maybe by image Size? ) I dunno what do you think its better to do, if I explain my self good.


Use a custom drag type for your ship objects.

Definitely DO NOT use image size as a way to identify the ship! That's just.... weird.

Learn about MVC (Model-View-Controller). Your ship objects are part of the model, which could include a list of possible ships, and a list of those ships which are at sea. Then your drag-n-drop operation really is just a cover for simply moving ship objects between the two lists. The shipsviewcontainer and the view that shows them at sea are just views that visualise the contents of your model.

If you forget about (for the moment) the way stuff is represented on screen and instead work on developing a model that accurately represents the various states of the system, you should find that questions about how to visualise things and other UI-level stuff like drag-n-drop become obvious. It sounds to me that right now you're trying to make your views be the model, which is a whole bag of hurt ;-)

hth,

Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to