Hello, to do this, first you need to enable multi touch for your application:
[self setMultipleTouchEnabled:YES];
Then to identify touches, you can use something like the following code:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for ( UITouch* Touch in touches )
{
printf( "Touch began %p, tapcount %d\n", (void *) Touch, [Touch tapCount] );
fflush( stdout );
}
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
for ( UITouch* Touch in touches )
{
printf( "Touch moved %p, tapcount %d\n", (void*)Touch, [Touch tapCount] );
fflush( stdout );
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
for ( UITouch* Touch in touches )
{
printf( "Touch ended %p, tapcount %d\n", (void*)Touch, [Touch tapCount] );
fflush( stdout );
}
}
So with the (void*)Touch, you can identify a particular touch pointer, which will not change until you actually "end" that touch.
For example, if you touch the screen, you will get a touch instance that will remain with the same memory address even if you move that finger, until you release it. Good luck with this, I used the bases of this code exactly for multi touch sprite management.