How can one limit the CCScrolLayer/CCLayer to a rect smaller than the screen size ? means:

CCLayer *page1;

When putting many pages in scroller, need all the items in the page to "disappear" when they reached some rect ( the scroller is above a "note page" boundaries hence cant get "out" of it)

Using the CCScrollLayer class extention

scroller = [[CCScrollLayer alloc] initWithLayers:[NSArray arrayWithObjects:pagesArray[0],pagesArray[1],pagesArray[2], nil] widthOffset:240];
    scroller.showPagesIndicator=0;
    scroller.pagesIndicatorNormalColor=ccc4(0, 0, 0, 20);
    scroller.pagesIndicatorPosition=ccp(winSize.width/2,winSize.height*0.17);
    scroller.pagesIndicatorSelectedColor=ccc4(239, 58, 104, 255);
    [scroller setDelegate:self];

Thank you very much .

有帮助吗?

解决方案

What you need is a clipping node. Please have a look at this tutorial.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top