Re: need help about the touch event
Re: need help about the touch event
- Subject: Re: need help about the touch event
- From: Randall Meadows <email@hidden>
- Date: Tue, 25 Aug 2009 07:58:43 -0600
On Aug 24, 2009, at 4:42 PM, Gill Bates wrote:
Hi All,
currently we have three kinds of touch event:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{ NSLog(@"touchesBegan"); }
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{ NSLog(@"touchesMoved"); }
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{ NSLog(@"touchesEnded"); }
what if I want to detect the time once user pressed at a specific
icon.
In particular, I want to implement some feature like iphone on the
homescreen, when the user pressed an icon for 2 seconds, the system
would show something.
So anyone has an idea for this?
In the -touchesBegan, set a timer for 2 seconds; in the timer
callback, do whatever it is you want to do (jiggle icons, for
example). However, if you get a -touchesEnded (or -touchesMoved, as
appropriate for your use case) *before* the timer fires, invalidate
the timer and carry on as if nothing happened.
_______________________________________________
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