views:

441

answers:

1

I added a label by using CCLabel to my layer. Now I want it do disappear after some time like (2sec). How can I make it to disappear?

CCLabel *labelPerfectDraw = [CCLabel labelWithString:@"Perfect Draw" fontName:@"Marker Felt" fontSize:30 ]; labelPerfectDraw.color = ccc3(0x00, 0x00, 0xff); labelPerfectDraw.position = ccp(windowSize.width/2, windowSize.height/2+80); [self addChild:labelPerfectDraw]; I added label in above way. Please give me the idea how can I work on it?

+3  A: 

There is a visible property for CCLabel instances as they are derived from CCSprite. That should do it. Just set it to false or rather you want it to disappear after 2 seconds so create a function attached to a timer which sets visibility to false.

Rob Segal
Thank you for the solution. Before the above solution, I have used the CCFadeOut to hide it and I have given the time for it to fade out. It worked. id actionLabel1 = [CCFadeOut actionWithDuration:1.5f];[labelLateDraw runAction:actionLabel1];Thank You again.
srikanth rongali
Ah ok. I missed part of what you were saying. Yes Fade Out works as well in that case.
Rob Segal