johnbakers
johnbakers

Reputation: 24750

Unable to retrieve simultaneous number of touches

In my UIView subclass I have this:

- (void) touchesBegan: (NSSet*) touches withEvent: (UIEvent*) event
{
    UITouch* touch = [touches anyObject];
    CGPoint location  = [touch locationInView: self];
    NSLog(@"touches count: %i",[touches count]); //always shows 1
}

No matter how many fingers I touch the screen with, I only get "1" as the output. I also added the above to touchesMoved with same results.

Upvotes: 0

Views: 75

Answers (2)

nielsbot
nielsbot

Reputation: 16022

I think there's a "multiple touch enabled" checkbox in interface builder... And also a corresponding property you can set.

Upvotes: 1

Nicos Karalis
Nicos Karalis

Reputation: 3773

Have you enabled the multitouch option?

[(your uiview) setMultiTouchEnabled:YES];

This is by default false, that will translate all touches on your view to one single touch in the middle of all other touches.

Setting it to YES will make your view recieve one touch event for each finger (or pen) on screen

Upvotes: 1

Related Questions