だから私は自分のゲームでCCPanZoomControllerを使っていて、あなたと同様の問題に遭遇しましたが、スプライトに触れたときなど、さまざまな側面で背景を動かしたくありませんでした。背景がズームしているときにスプライトが動かないようにしました。だから私がしたことは、反応したくないレイヤーのタッチを「オフ」にして、他のレイヤーでのアクションが完了したらそれらを再度有効にするメソッドを作成することでした。
各レイヤー内に次のメソッドを作成して、さまざまなタッチイベントから呼び出すタッチを無効または有効にしました。
// Public Method: Allows for disabling touch for this layer and re-enabling it
-(void)enableTouches:(BOOL)enable
{
// Check if the bool value is to enable or disable touches
if (enable) {
// Call for the removal of all touch locations in array in the CCLayerPanZoom instance
[_panZoomLayer removeTouchesFromArray];
// Call the touch dispatcher and add the CCLayerPanZoom back as a delegate for touches
[[CCTouchDispatcher sharedDispatcher] addStandardDelegate:_panZoomLayer priority:0];
CCLOG(@"PanZoomWrapperLayer:enableTouches - LayerPanZoom touches enabled");
} else {
// Call the touch dispatcher to remove the CCLayerPanZoom as a delegate to disable touches
[[CCTouchDispatcher sharedDispatcher] removeDelegate:_panZoomLayer];
CCLOG(@"PanZoomWrapperLayer:enableTouches - LayerPanZoom touches disabled");
}
}