Reputation: 1233
Is there any native cocos2d method to calculate touch duration or to detect long touch or small drag not using UILongPressGestureRecognizer
?
Upvotes: 0
Views: 327
Reputation: 21996
It's a matter of registering the time between a ccTouchBegan and ccTouchEnded event.
A UITouch object has this property:
@property(nonatomic, readonly) NSTimeInterval timestamp;
So simply store the value of the first time interval in some ivar when you get a ccTouchBegan event, and make the difference with the time that you get in ccTouchEnded.
Upvotes: 2