我使用cocos2d的渲染精灵,和UIGestureRecognizers多个姿势,以允许用户平移,旋转和缩放精灵。为UIGestureRecognizers(iPhone,cocos2d的)
我有使用如下代码隔离每个工作:
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];
不过,我想规模和如果用户同时旋转捏他们的手指一起旋转精灵(照片应用程序呢这个,例如)。不幸的是,识别器似乎陷入了“旋转”或“捏”模式,并且不会同时调用这两个处理器:(
所以,基本上,我想知道 - 这是否意味着我不能使用UIGestureRecognizers?我可以将两个识别并完成所有的动作在单处理器?我将不得不继承UIGestureRecognizer是类似“PinchAndRotateRecognizer”。
帮助赞赏:)
这是不正确的。只需实现gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:在您的委托中,请参阅下面的答案。 –