首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Instructions.m (游戏说明)没有打印出说明吗?

Instructions.m (游戏说明)没有打印出说明吗?
EN

Stack Overflow用户
提问于 2012-08-09 03:51:51
回答 1查看 95关注 0票数 0

我正在创建一个iphone应用程序,由于某些原因,当我运行代码时,指令不会出现。这是我的instructions类。当我运行程序时,什么也没有显示。

“这个游戏的目标是”不应该出现在屏幕上吗?

感谢您能为我提供的一切帮助/知识:)

代码语言:javascript
复制
#import "Instructions.h"
#import "MainMenu.h"

@implementation Instructions

+ (CCScene *) scene
{
    CCScene * scene = [CCScene node]; // scene is an autorelease object
    Instructions * layer =  [Instructions node]; // later is an autorelease object
    [scene addChild: layer]; // add layer as a child to scene
    return scene; // return the scene
}

- (id) init
{
    if ( ( self = [super init] ) )
    {
        [ self how ];
    }
    return self;
}

- (void) how
{
    NSLog(@"The object of this game is ");
}
@end
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-09 04:25:00

NSLog在屏幕上什么也不做。它只是在Xcode的控制台中打印文本。

要在屏幕上显示文本,请尝试制作标签。如下所示:

代码语言:javascript
复制
- (void) how
{
    // Create the label
    CCLabelTTF *label = [CCLabelTTF labelWithString:@"The object of this game is..." fontName:@"Arial" fontSize:30];

    // Position it on the screen
    label.position = ccp(160,240);

    // Add it to the scene so it can be displayed
    [self addChild:label z:0];
}

有关标签的更多信息,请访问:http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:labels

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11872127

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档