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 protected])

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 [email protected]

Reply via email to