Tracking Multiple Touches For Appropriate Label
Tracking Multiple Touches For Appropriate Label
- Subject: Tracking Multiple Touches For Appropriate Label
- From: Chunk 1978 <email@hidden>
- Date: Mon, 7 Dec 2009 19:12:35 -0500
for 2 days now i've had unsuccessful attempts at trying to track
UITouches that share the same view.
i have a plain, full screen view that accepts multiple touches. i
have 3 labels titled "Touch1", "Touch2", "Touche3". all i'm trying to
accomplish is to output the coordinates of the touches thru the labels
and update the appropriate label according to the number of touches on
the screen.
so if one finger is touching and moving around the screen, Touch1 will
display it's coordinates. if 2 fingers are touching or moving around
the screen than Touch2 will show the second's touches coordinates
while Touch1 is still being tracked by the first finger. if 3 fingers
are touching the screen, Touch3 will show the coordinates of the 3rd
finger.
my current, non working state:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([[[event allTouches] anyObject] view] == self)
{
for (UITouch *touch in touches)
{
CGPoint touchPoint = [[touches anyObject] locationInView:self];
switch ([touches count])
{
case 1: [self Touch1:touchPoint];
break;
case 2: [self Touch2:touchPoint];
break;
case 3: [self Touch3:touchPoint];
break;
case 4: [self Touch4:touchPoint];
break;
}
}
}
}
_______________________________________________
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