わかりました、正直なところ、ウィンドウフレームをスクロールオブジェクトよりも高いzに配置します...ウィンドウコンテンツのスプライトをオンザフライでトリミングおよび変更する必要がある場合があります(少なくともそれが私ができる1つの方法です)これ以上の調査は必要ありません)。
それで :
// initialize this logic somewhere useful
CCNode scrollableContent;
CCSprite windowFrame;
BOOL isScrollPossible;
[self addChild:scrollableContent z:0];
[self addChild:windowFrame z:1];
// and in the touch delegate methods
-(void) ccTouchBegan:{
check if the touch happened in the window, if yes, scrolling is possible
}
-(void) ccTouchMoved:{
if (isScrollPossible) {
compute displacement
compute nextPosition for scrollableContent node;
if ( nextPosition in window ) {
// make scrollableContent follow touch
scrollableContent.position=nextPosition;
} else {
// stop any further scrolling until the next 'touch began'
isScrollPossible=NO;
}
} else {
// scroll not possible, do nothing
}
}
これが基本的な考え方です。ウィンドウの端を越えて scrollableContent が忍び寄るのを防ぐために、クランプ ロジックが必要になる場合があります。
タイプミスのため編集しました。