Search code examples
iphoneobjective-cipadtouchesbegantouches

Why does touchesBegan not fire when the number of touches changes?


For some reason my touchesBegan method doesn't seem to be responding correctly. If I touch the screen with two fingers, then lift one up and put it down again, touchesBegan gets called correctly. If I touch the screen with one finger, then add a second finger, touchesBegan does not get called like it should. Is there some flag that I need to check? Below is a sample that illustrates my problem:

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
     NSLog(@"touch");
}

Any ideas what's going on? I'm testing on an iPad with iOS 4.2 if it matters.


Solution

  • Yes, you need to set the multipleTouchEnabled property on your view.

    When set to NO, the receiver receives only the first touch event in a multi-touch sequence. The default value of this property is NO.