2012-03-22 4 views
0

내가적인 Cocos2D로 스크롤 레이어를 할 노력하고있어수직 스크롤 CCLayerColor 문제

계층에 상관없이 내가 그것을 레이어 장면에 들어갈 때 무엇을 위에서 아래로 스크롤 시작 없지만하기 위해 내가 원하는 것은 (0,0) aka..bottom

에 위치 난 일이지만 아무것도 몇

-(id) init 
{ 
    if((self=[super init])) { 
     self.isTouchEnabled = YES; 
     isDragging = NO; 
     yvel = 0.0f; 
     contentHeight = 1000.0f; 

     scrollLayer = [CCLayerColor layerWithColor:ccc4(200, 200, 200, 240)]; 
     scrollLayer.contentSize = CGSizeMake(320,contentHeight); 
     scrollLayer.anchorPoint = ccp(0,1); 
     scrollLayer.position = ccp(0, 480); 
     [self addChild: scrollLayer]; 


     CCLabelTTF *label = [CCLabelTTF labelWithString:[NSString stringWithFormat:@"test label"] 
                fontName:@"Marker Felt" 
                fontSize:24]; 

     label.position=ccp(100, 100); 

     [scrollLayer addChild:label]; 


     [self scheduleUpdate]; 
    } 
    return self; 
} 

다른 방법이 갱신됩니다 작동하는 것 같다 시도하고 핸들러를 접촉 한

그래서 문제가되지 수 있을거야

이 코드가 포함 된

... 화면 왼쪽 상단의 콘텐츠로 초기화하면 안됩니까?

답변

0
내가 마지막으로 문제를 해결 고통스러운 몇 시간 후

...하지만 난 여전히 그것이

그리고 난 아무것도

을하고 않네 사촌 내가 scrollLayer.position =ccp(0,-contentHeight);로 대체하고 scrollLayer.anchorPoint = ccp(0,1);을 삭제 scrollLayer.position = ccp(0, 480);

대신 작동하는 이유를 잘 모릅니다 왜 작동하는지 전혀 모른다.

누군가 설명 할 수 있는가?