SpriteWalkthrough(Apple doc)翻译成Swift

时间:2015-07-09 19:44:25

标签: ios objective-c swift sprite-kit code-documentation

在SpriteViewController中

在Apple的Obj-C中

- (void)viewDidLoad
{
    [super viewDidLoad];
    SKView *spriteView = (SKView *) self.view;
    spriteView.showsDrawCount = YES;
    spriteView.showsNodeCount = YES;
    spriteView.showsFPS = YES;
}
在斯威夫特,我: super.viewDidLoad()

if let spriteView: SKView = self.view as? SKView {
    spriteView.showsDrawCount = true
    spriteView.showsNodeCount = true
    spriteView.showsFPS = true

    println("It works! :)");
} else {
    println("It doesn't work! :(")
}

我总是得到"它不起作用! :("

有人能告诉我我做错了吗?

如果您想了解有关该项目的更多信息,请see this.

谢谢!

0 个答案:

没有答案