this is what i have so far, but i have no idea how to write the touchesEnded method so that the appropriate label will clear. so if 3 fingers are touching the screen and displaying their different coordinates, if the 2nd finger that was pressed ends its touch, the 2nd label will clear ("Touch 2: {0, 0}") while the 1st and 3rd continue to track. clearly i'm lost, i apologize.
- (void)viewDidLoad { labelsArray = [[NSArray alloc] initWithObjects:touchLabe1, touchLabe2, touchLabe3, nil]; touchesArray = [[NSMutableArray alloc] initWithCapacity:3]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { for (UITouch *touch in touches) [touchesArray addObject:touch]; for (NSUInteger i = 0; i < 3; i++) { UILabel *aLabel = [labelsArray objectAtIndex:i]; if (i < [touchesArray count]) { UITouch *touch = [touchesArray objectAtIndex:i]; NSString *point = NSStringFromCGPoint([touch locationInView:self.view]); aLabel.text = [NSString stringWithFormat:@"Title %i:\n%@", i+1, point]; } } } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { for (NSUInteger i = 0; i < 3; i++) { UILabel *aLabel = [labelsArray objectAtIndex:i]; if (i < [touchesArray count]) { UITouch *touch = [touchesArray objectAtIndex:i]; NSString *point = NSStringFromCGPoint([touch locationInView:self.view]); aLabel.text = [NSString stringWithFormat:@"Title %i:\n%@", i+1, point]; } } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { //?? } On Tue, Dec 8, 2009 at 11:01 AM, mmalc Crawford <mmalc_li...@me.com> wrote: > > On Dec 8, 2009, at 3:49 am, Chunk 1978 wrote: > >> i meant that i find it complicated compared to basic single touches or >> gestures. >> > It's not clear what's complicated. > > You typically want to know when touches began, moved, and ended, and there > are methods to inform you when each of these things happen (and another to > let you know that they've been interrupted). > > This is a multi-touch system, so just because one touch began it doesn't mean > all did. So in some cases at least (including, it seems, yours) you need a > means to get information about other touches. The methods therefore all tell > you: "Here are the touches that have just entered the phase you're interested > in in this method, and here's a data structure (the UIEvent object) that > gives you a way to get information about all the current touches". > > It's difficult to see how this could be simpler. About the only > simplification could be that the methods could take a single parameter... > there are a couple of scenarios for this. The methods could just pass the > UIEvent object -- but then you'd have to iterate through its touches to find > the ones that are in the phase you're interested in. Or you could have two > (or three) methods per phase, e.g. touchesBegan: and touchesBeganInEvent: > (and maybe again touchesBegan:withEvent:), but then you're making things more > complicated again with multiple override points. > > mmalc > > _______________________________________________ > > 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/chunk1978%40gmail.com > > This email sent to chunk1...@gmail.com > _______________________________________________ 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