-
Notifications
You must be signed in to change notification settings - Fork 59
CCLongPressGestureRecognizer
spalx edited this page Apr 30, 2013
·
3 revisions
CCLongPressGestureRecognizer is a subclass of CCGestureRecognizer that looks for long-press gestures. The user must press a finger on a node for at least a specified period for the action method to be called.
//the minimum period (seconds) the finger must press on the view for the gesture to be recognized
//default value is 0.5
float minimumPressDuration;
CCLongPressGestureRecognizer * longPress = CCLongPressGestureRecognizer::create();
longPress->setTarget(this, callfuncO_selector(HelloWorld::didLongPress));
longPress->setMinimumPressDuration(0.6);
longPress->setCancelsTouchesInView(true);
this->addChild(longPress);
The CCLongPress object that you receive after a successful long-press recognition, contains the following public members:
//the location of the gesture
CCPoint location;