I use Cocos2d to render the sprite and UIGestureRecognizers to allow the user to pan, rotate and scale the sprite.
I work in isolation using the following code:
UIPinchGestureRecognizer *pinchRecognizer = [[[UIPinchGestureRecognizer alloc] initWithTarget:layer action:@selector(handlePinchFrom:)] autorelease]; [viewController.view addGestureRecognizer:pinchRecognizer]; UIRotationGestureRecognizer *rotationRecognizer = [[[UIRotationGestureRecognizer alloc] initWithTarget:layer action:@selector(handleRotationFrom:)] autorelease]; [viewController.view addGestureRecognizer:rotationRecognizer];
However, I want to both scale and rotate the sprite if the user holds his fingers together during rotation (for example, the Photos application). However, unfortunately, the recognizer seems to get stuck in the "rotate" or "pinch" mode and will not simultaneously call both handlers: (
So basically, I want to know - does this mean that I cannot use UIGestureRecognizers? Can I combine two recognizers and perform all the actions in one handler? Should I subclass UIGestureRecognizer to be something like "PinchAndRotateRecognizer".
Help rate :)
source share