• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: need help about the touch event
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >need help about the touch event (From: Gill Bates <email@hidden>)

  • Prev by Date: NSImage with multiple representation sizes
  • Next by Date: Re: Core Data dog-slow when using first time after boot
  • Previous by thread: need help about the touch event
  • Next by thread: CoreData / SQL hang on save
  • Index(es):
    • Date
    • Thread