I am creating a CCScrollview in my app
scrollView = CCScrollView::create();
scrollView->retain();
scrollView->setViewSize(CCSize(size.width,size.height - 100));
scrollView->setContentSize(CCSize(size.width,1000));
scrollView->setDirection( kCCScrollViewDirectionVertical );
scrollView->setPosition(ccp( 0,50 ) );
scrollView->setContainer( this->getParent() );
this->addChild(scrollView, 5);
now when i add a child to the scrollview like so:
titleLabel = CCLabelTTF::create("Squares", "Thonburi", 20);
titleLabel->setPosition(ccp(0, scrollView->getViewSize().height*0.90));
scrollView->addChild(titleLabel, 1);
it renders at the correct spot which is 0,50 with an anchor point on 0,0
if i change the anchor point though to say 1,1 like so
titleLabel->setAnchorPoint(ccp(1, 1));
it still renders as if it has an anchor point of 0,0
anyone know why this happens? or how i can fix it?
It happens, because CCScrollView resets the anchor point for added children to the container view:
I am actually not sure, why this is necessary. A way to fix that would be to add a CCNode to the container first and add all your children to that container.