I have been wrestling with multi-touch 'finger tracking' for a few weeks now. My background is in hardware and embedded systems programming, so I'm inexperienced with anything other than micro-controller programming. I achieved some success, but only when multiple touches start and finish at the same time. My project is a gestural control interface for audio hardware, so I need to track each touch in order to produce custom gestures.
This example shows how I extract each touch from [touches allObjects] in order to process them individually (I excluded the processing code, it's superfluous to this example)
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
touchesArray = [touches allObjects]; //Array Declared in header to hold multiple touches.
NSUInteger nNumTouches = [touchesArray count]; //Counts number of touches in Array
UITouch *touch = [touches anyObject];
CGPoint ptTouch;
for (int nTouch = 0; nTouch < nNumTouches; nTouch++)
{
touch = [touchesArray objectAtIndex:nTouch];
ptTouch = [touch locationInView:self.view];
{
Is there a more effective method of tracking each touch? I feel I've hit the end of my programming knowledge. Especially after trying to manipulate an NSMutable Array to no effect. I've also read, and failed to execute details from here: https://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/multitouch_background/multitouch_background.html#//apple_ref/doc/uid/TP40009541-CH5-SW9
The response to this looks interesting, but I couldn't get it to work in context:
how to track multitouch events on iphone?
Thanks for your time, any advice would be much appreciated,
Tom.