Multi-touch does not work in the iphone application that I am creating

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. Are there any settings that may prevent my application from making multiple touches? Or am I missing something here?

+3
source share
2 answers

You need to enable "multiple touch" on your view in InterfaceBuilder

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

or if you created a view in the code installed with

[theView setMultipleTouchEnabled:YES];
+10
source

, , . , - , , .

+1

Source: https://habr.com/ru/post/1703979/


All Articles