Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocos2d iphone cocos2d-CCLabelTTF不会打印多次_Cocos2d Iphone - Fatal编程技术网

Cocos2d iphone cocos2d-CCLabelTTF不会打印多次

Cocos2d iphone cocos2d-CCLabelTTF不会打印多次,cocos2d-iphone,Cocos2d Iphone,我疯了 我已经这样做了很多次,现在它只是不工作 在我的init方法中,我有以下标签: teamLabel = [CCLabelTTF labelWithString:@"WAITING..." fontName:@"Marker Felt" fontSize:32]; teamLabel.position = ccp( 150,100); teamLabel.color = ccc3(150, 50, 80); [self addChild:tea

我疯了

我已经这样做了很多次,现在它只是不工作

在我的init方法中,我有以下标签:

teamLabel = [CCLabelTTF labelWithString:@"WAITING..." fontName:@"Marker Felt" fontSize:32];
        teamLabel.position = ccp( 150,100);
        teamLabel.color = ccc3(150, 50, 80);
        [self addChild:teamLabel];

        [teamLabel setVisible:YES];
然后我调用了一个函数,我知道它已经被调用了(NSLOG),在那里我试图以各种方式打印一些东西:

[teamLabel setString:@"ran"];
[teamLabel setString:[NSString stringWithFormat:@"%ig", (int) (ran)]]; //ran int==5;
函数已启动,但我仍然可以在标签中看到init中的第一个字符串,没有任何更改

编辑::

它现在打印一个红色的大正方形,大小和我的字差不多。如果单词很小,我会得到小红方块等等

那是什么


谢谢。

我曾经遇到过类似的行为,结果是由于缺少内存来分配TTF纹理

也许你一直在提高你的游戏/应用程序资源利用率,现在你也看到了同样的行为

尝试禁用许多其他资源,或仅创建TTF标签。您还可以尝试将这些TTF的创建移出init方法,以检查是否存在加载顺序/优先级问题


干杯,

您确定teamLabel是非零且可见的吗?我已将其设置为可见,如您所见,如果一开始它实际工作,并且我可以看到单词waiting,那么它怎么可能为零。然后我使用[teamLabel setString:@“ran”];那你说零是什么意思?