Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-touch is not working in the iphone app I'm building

I have the following code:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {


NSUInteger touchCount = 0;
// Enumerates through all touch objects
for (UITouch *touchb in touches){
    touchCount++;
}


// When multiple touches, report the number of touches. 
if (touchCount > 1) {
    lblStatustouch.text = [NSString stringWithFormat:@"Tracking %d touches", touchCount];
} else {
    lblStatustouch.text = [NSString stringWithFormat:@"Tracking 1 touch", touchCount];
}

When I run it, it never detects more than one touch. Is there some setting that may prevent my app from taking multiple touches? Or am I missing something here?

like image 479
Bryan Cimo Avatar asked Dec 09 '25 12:12

Bryan Cimo


1 Answers

You need to enable "Multiple Touch" on your View in InterfaceBuilder

alt text http://img.skitch.com/20090227-rpkafsxtg56pujk1h1583if88i.jpg

or if you have created the View in code it's set with

[theView setMultipleTouchEnabled:YES];
like image 100
epatel Avatar answered Dec 11 '25 04:12

epatel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!