Game Development Reference
In-Depth Information
-(void) alertView:(UIAlertView*)alertView←
NSString* message = @"Well";
ccColor3B labelColor = ccYELLOW;
if (buttonIndex == 1)
message = @"Done";
labelColor = ccGREEN;
CCLabelTTF* label = [CCLabelTTF labelWithString:message
CGSize size = [CCDirector sharedDirector].winSize;
label.position = CGPointMake(CCRANDOM_0_1() * size.width,←
CCRANDOM_0_1() * size.height);
label.color = labelColor;
[self addChild:label];
// keep the alert view alive by bringing it up again
[self showAlertView];
The showAlertView method is called again whenever the alert view has been dis-
missed, so the alert view will keep showing up again, allowing you to add another label
to the cocos2d view. You can see the result in Figure 15-1 .
Search Nedrilad ::

Custom Search