Re: best practice to create Custom Objects represented by a image in a d-n-d operation
Re: best practice to create Custom Objects represented by a image in a d-n-d operation
- Subject: Re: best practice to create Custom Objects represented by a image in a d-n-d operation
- From: Gustavo Pizano <email@hidden>
- Date: Tue, 9 Dec 2008 09:10:08 +0100
On 9.12.2008, at 0:01, Graham Cox wrote:
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
In fact I have my ships the grid and the cells in my model level, teh
controllers (AppController, which is in charge of the logic of the
game, and ViewController, which is in charge of controlling the
output) in a controller level, and the views are, well, in a view
level. Last night when I went to bed I realize myself that I was
making mistake trying to identify the ship my image size, I asked
myself what if the image size change? well, then yes what you say is
better, in the ShipsContainerView I will instantiate each ship, I
will put each object in the pb and then in the destination I will get
the object, that should be the best way.
Thanks for your help
G
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden