1

我正在尝试创建CCLabelTTF文本随着故事的进展而变化的位置,但我无法为其设置一段简单的文本。标签当前显示(空),我似乎无法让它显示“这是文本”。NSLog正确返回它,但标签不会显示它。我还确保标签没有被破坏。这是代码:

    CGSize narrativeTextSize;
    narrativeTextSize.width=740;
    narrativeTextSize.height=60;

    CCLabelTTF  *narrativeTextLabel =[CCLabelTTF labelWithString:[NSString
                                                                   stringWithFormat:@"%@", narrativeText]
                                                       dimensions:narrativeTextSize
                                                       hAlignment:UITextAlignmentLeft
                                                    lineBreakMode:UILineBreakModeWordWrap
                                                         fontName:@"Helvetica"
                                                         fontSize:20];

    narrativeTextLabel.position =  ccp(255,60);

narrativeText = @"This is text";

//NSLog(@"%@", narrativeText);

[gameMenu addChild:narrativeTextLabel];
4

1 回答 1

1

写吧

narrativeText = @"This is text"; 上面 CCLabelTTF *narrativeTextLabel...线。

于 2013-05-27T06:30:16.210 回答