Touch-and-drag architecture question
Touch-and-drag architecture question
- Subject: Touch-and-drag architecture question
- From: Dave DeLong <email@hidden>
- Date: Sun, 14 Feb 2010 14:38:39 -0700
Hi everyone,
I've an iPhone app that I'm working on (it's a simple game), where I've got the game board on the screen, and then a row of pieces above and below the board (representing the pieces controlled/captured by each player). I'd like to be able to drag pieces from these rows onto the board. My question is this:
How should I set up the view hierarchy to do the drag and drop? As I see it, there are three main ways:
1. Use different views for the board and the two rows. This is good for encapsulation, but bad for cross-view dragging.
2. Use a single view for the board and the two rows. This is bad for encapsulation, but makes dragging much easier.
3. Use different views for the board and the two rows, but have an invisible view on top of everything that captures all the events and passes them on accordingly. I'm not sure how this would work out.
Perhaps another important question is: how should pieces be rendered? I've been drawing them with CoreGraphics (hence the difficulty of dragging them between views), but I could also make each piece its own UIView (which might complicate dragging in other ways).
What do you suggest?
Thanks!
Dave DeLong
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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