views:

83

answers:

2

Hi, I draw a cocos2d scene in window and now want to add a label on top of the scene... Any idea?? Thanks

+1  A: 

You should use CCLabel instead of UILabel when using cocos2d.

First you create a label, then you add the label to your scene.

Have a look here : http://www.cocos2d-iphone.org/api-ref/latest-stable/interface_c_c_label.html

parceval
+1  A: 

If you want to use Cocos native Label class: add any CCLabel - the are plenty of them - to your CCScene.

CCLabel * label = [CCLabel labelWithString:@"MyString" 
                                  fontName:@"Arial" 
                                  fontSize:12.0];
// you could sort your layers by "Z" - here 99 (default:0)
[self addChild:label z:99]; 

If you want to use UILabel.. may be you could just add your UILabel to the window class located in your application delegate class "myapp_delegate.m" . May be you should add an UIView first.

hhamm