Re: Tracking Multiple Touches For Appropriate Label
Re: Tracking Multiple Touches For Appropriate Label
- Subject: Re: Tracking Multiple Touches For Appropriate Label
- From: mmalc Crawford <email@hidden>
- Date: Tue, 08 Dec 2009 00:50:28 -0800
On Dec 8, 2009, at 12:38 am, mmalc Crawford wrote:
>> is this suppose to work for multiple touches where one touch is
>> already present, then another touches the screen?
>>
> Yes, it does; tested in a working application.
>
>> it's not working for me. each time i touch the screen and add an object to the
>> myTouches array the return count always returns 1, no matter how many
>> fingers i already have touching the screen.
>>
> Then despite your original assertion, it is likely that you haven't set multipleTouchEnabled on your view.
>
I misread the reply.
Per the documentation for touchesBegan:withEvent:,
"touches
A set of UITouch instances that represent the touches for the starting phase of the event represented by event."
<http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/touchesBegan:withEvent:>
(see also <http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/EventHandling/EventHandling.html#//apple_ref/doc/uid/TP40007072-CH9-SW15>).
If you already have one finger touching the screen, and you add another, then 'touches' will only contain one touch.
If you want the coordinates of all the current touches that happen to be present when another touch is added, then you need to get allTouches from the event.
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden