Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i disable touchesBegan: for multi-touches?

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

I am currently getting 1 object in

touches 

when I do a tap with two fingers simultaneously (holding option key and clicking on the simulator). I believe this is because I haven't enabled the

multipleTouchEnabled 

property of the attached view. I want to make it so that I don't register this event for multi-touches.

Looking into the issue, it seems like it would work if I enable multipleTouchEnabled, and then do

if ([touches count] > 1) {
    return;
}

in my

touchesBegan:

However, this seems strange to me in that I am ENABLING multipleTouchEnabled to DISABLE multiple touches, and am worried if there will be side-effects. Is there a better way to solve my problem?

like image 263
Popcorn Avatar asked Feb 11 '13 21:02

Popcorn


1 Answers

You should just be able to disable the multitouch property on the view , in IB you have to actually go over to the side panel and click on the thing that says view next to files owner to get it and then uncheck it, or you could do it in code in viewdidload:

self.view.multiTouchEnabled = NO;

like image 63
Suhaiyl Avatar answered Dec 07 '22 19:12

Suhaiyl