On Mar 8, 2010, at 09:13, Gustavo Pizano wrote: > I was reading some older post about something similar. What I want to achieve > is that I have a room with seats and I want to check the seats to reserve. > Now I did something alike in Cocoa retrieving the view under the hitTest, > then I got the id of the view (custom identification) and then I new which > number shall I reserve. > > Btu for iPhone I dunno how big this process might be, Im talking about 220 - > 250 seats. I was thinking in placing inside a UIScrollView my map of seats > and a button with a tag identifier for each seat in a button grid, but im not > happy with having so many buttons. > > Then I thought making CGPaths, but then to check which path contains the > touch point... ???? :S:S:S not nice. > > Any idea how can I achieve this in a fancy "easy" solution? > > knowing that the server will tell me whats reserve already I must color each > seat and don't allow touch events on that area, or well at least don't > respond to them.
Using hundreds of buttons seems a bit heavy-handed even for the Mac, let alone iPhone. Any kind of one-subview-per-seat solution seems undesirable. Even constructing hundreds of paths to hit-test screen locations seems like overkill. If you have a room with seats, likely the room has a small number of sections (maybe only one) in which seats are laid out in a grid. Therefore you only need to keep the bounds of each section. It should be straightforward to translate a touch location into a grid position mathematically. Or, in the worst case, keep each seat as a separate rectangle and test the touch location against the rectangles. If you need non-rectangular hit testing, then it's still likely better to test against rectangular bounds rects first, and test against a more complex shape only when the first test succeeds. _______________________________________________ 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 arch...@mail-archive.com