Cocos2d: add uilabel in scene

I draw a cocos2d scene in a window and now I want to add a shortcut on top of the scene ... Any ideas ?? Thanks

+3
source share
3 answers

You should use CCLabel instead of UILabel when using cocos2d.

First you create a tag, and then add a shortcut to your scene.

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

+2
source

If you want to use your own Cocos label class: add any CCLabel — there are many — 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]; 

UILabel.. , UILabel , "myapp_delegate.m". , UIView.

+2

Cocos2d CCLabel, CCLabelTTF

CCLabelTTF * label = [CCLabelTTF labelWithString:@"MyString" fontName:@"Arial" fontSize:12.0];

[self addChild:label z:99];
+2
source

Source: https://habr.com/ru/post/1757660/


All Articles