On Jul 12, 2011, at 4:49 PM, Nathan Sims wrote:
> On Jul 12, 2011, at 4:46 PM, Fritz Anderson wrote:
>> On 12 Jul 2011, at 6:30 PM, Nathan Sims wrote:
>>> I have a, iOS 4.3.3 UIView that is touch-enabled. When my 
>>> -touchesBegan:withEvent: method gets called, I can't figure out how to 
>>> differentiate when the user touched the screen with one finger or with two. 
>>> Either way, I receive this:
>>> 
>>> <UITouchesEvent: 0x1796e0> timestamp: 423888 touches: {(
>>>  <UITouch: 0x1d2ab0> phase: Began tap count: 1 window: <UIWindow: 0x197ac0; 
>>> frame = (0 0; 768 1024); opaque = NO; autoresize = RM+BM; layer = <CALayer: 
>>> 0x197c40>> view: <UIView: 0x1a1330; frame = (20 0; 748 1024); transform = 
>>> [0, -1, 1, 0, 0, 0]; autoresize = W+H; layer = <CALayer: 0x1a13c0>> 
>>> location in window: {572, 338} previous location in window: {572, 338} 
>>> location in view: {686, 552} previous location in view: {686, 552}
>>> )}
>>> 
>>> It tells me the 'tap count' but nowhere does it indicate if the user 
>>> applied two fingers or just one. Instead of double-tapping or some other 
>>> gesture, I need to make two fingers to mean 'quit the ongoing activity' to 
>>> my program, whereas one finger means 'change value according to where the 
>>> finger touched'. 
>>> 
>>> Am I looking in the wrong place for this touch information?
>> 
>> The other parameter is there for a reason. It is a set of UITouches. Sets 
>> can be counted.
> 
> I know, but [touches count] always returns 1, so I've resorted to [[event 
> allTouches] count]; seems to work reliably.
> Thanks!

The set of touches passed to -touchesBegan:withEvent: include only the 
newly-touched touches. Existing touches already in progress are not part of 
that set, but are part of -allTouches.

Most likely, you're seeing the user's fingers not hit the screen 
simultaneously. Then you would get two calls to -touchesBegan:withEvent:, each 
with one new touch.


-- 
Greg Parker     gpar...@apple.com     Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to