Skip to content

CCPinchGestureRecognizer

spalx edited this page Apr 30, 2013 · 3 revisions

CCPinchGestureRecognizer is a subclass of CCGestureRecognizer that looks for pinching gestures involving two touches. When the user moves the two fingers toward each other, the conventional meaning is zoom-out; when the user moves the two fingers away from each other, the conventional meaning is zoom-in. Pinching is a continuous gesture, and thus the associated action method is called every time a finger moves enough to be considered a pinch gesture.

Example

CCPinchGestureRecognizer * pinch = CCPinchGestureRecognizer::create();
pinch->setTarget(this, callfuncO_selector(HelloWorld::didPinch));
pinch->setCancelsTouchesInView(true);
this->addChild(pinch);

CCPinch

The CCPinch object that you receive after a successful pinch recognition, contains the following public members:

//type of the pinch gesture that fired the target method
CCPinchGestureRecognizerType type;

Pinch types

  1. kPinchGestureRecognizerTypeClose
  2. kPinchGestureRecognizerTypeOpen