[SOLVED]How to set Layer inside CCScrollView

[SOLVED]How to set Layer inside CCScrollView
0.0 0


Hi , thanks for your attention.
I am trying to use CCSCrollVIew, but i am having some problems of understanding.
First asking if there is some manual or tutorial where i can have a look, cause i didn´t found anything related.
Later if someone can explain me how to get a very height layer inside the CCScrollView, so it is scrollable vertically.
I have this code

CCSize _size = CCDirector::sharedDirector()->getWinSize(); CCLayerColor* layer= CCLayerColor::create((ccColor4B){100,100,100,100}); layer->setContentSize(CCSizeMake(_size.width,1500)); CCScrollView* scroll=CCScrollView::create(CCSizeMake(_size.width,_size.height-200)); scroll->setClippingToBounds(true); scroll->setDirection(kCCScrollViewDirectionVertical); scroll->addChild(layer,1); this->addChild(scroll);

Please folks, help me since i am really stuck on this code.Thanks to all !


try doing your


after your


. Also maybe you need a


for the CCSCrollView on the CCLayerColor


I finally get it working,
the solution was adding:
@ scroll->setContainer(layer);@ and thats it
I have another question:
How we can set the initial scroll values?
I want the layer to be scrolled to top , so it not appears at the bottom in scrollview.
Thanks in advantage.