Skip to content

Instantly share code, notes, and snippets.

@is8r
Created June 29, 2014 11:01
Show Gist options
  • Save is8r/43f012ab06a9feee391e to your computer and use it in GitHub Desktop.
Save is8r/43f012ab06a9feee391e to your computer and use it in GitHub Desktop.
- (void) initScrollLayer
{
int pageMax = 3;//ページ数
CGSize s = [[CCDirector sharedDirector] winSize];
//ScrollLayer
scroll = [ScrollLayer node];
[scroll changeContentWidth:s.width*pageMax];
[self addChild:scroll];
//Label
CCLabel* l0 = [CCLabel labelWithString:@"PAGE01"
dimensions:CGSizeMake(320, 16)
alignment:UITextAlignmentCenter
fontName:@"Helvetica"
fontSize:16
];
l0.position = ccp( 160 , 240-8 );
[scroll addScrollChild:l0];
CCLabel* l1 = [CCLabel labelWithString:@"PAGE02"
dimensions:CGSizeMake(320, 16)
alignment:UITextAlignmentCenter
fontName:@"Helvetica"
fontSize:16
];
l1.position = ccp( 160+320 , 240-8 );
[scroll addScrollChild:l1];
CCLabel* l2 = [CCLabel labelWithString:@"PAGE03"
dimensions:CGSizeMake(320, 16)
alignment:UITextAlignmentCenter
fontName:@"Helvetica"
fontSize:16
];
l2.position = ccp( 160+(320*2) , 240-8 );
[scroll addScrollChild:l2];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment