I have developed an iOS app using Sprite Kit. Anyone that has developed an iOS game with Sprite Kit knows of the label at the bottom corner with debugging information. I am trying to remove the debugging information on the bottom corner which gives the number of nodes and fps. (ex. 1 node 60.0 fps)
我用Sprite Kit开发了一个iOS应用。任何使用Sprite Kit开发iOS游戏的人都知道底部角落的标签,上面有调试信息。我正在尝试删除底部角落的调试信息,它给出节点和fps的数量。(例1节点60.0 fps)
I tried the following code in the -(id)initWithSize:(CGSize)size
method in my .m
file but it doesn't seem to do anything. Is this the correct code for removing the debugging label or is there a better way to remove the label?
我在我的.m文件中尝试了-(id)initWithSize:(CGSize)size方法中的以下代码,但它似乎没有任何作用。这是删除调试标签的正确代码,还是有更好的方法删除标签?
SKView *spriteView = (SKView *) self.view;
spriteView.showsNodeCount = NO;
spriteView.showsFPS = NO;
4 个解决方案
#1
14
-(id)initWithSize:(CGSize)size
is not the method where you do this. I guess you are doing this in subclass of SKScene
. You should do it in ViewContoller
. Go to the ViewController
there in viewWillLayoutSubviews
. Just find that somewhere in your code you did this:
-(id)initWithSize:(CGSize)size不是这样做的方法。我猜你是在SKScene的子类中做这个。你应该在ViewContoller中执行。到viewWillLayoutSubviews中的ViewController。在你的代码中找到这样做的地方:
skView.showsFPS = YES;
skView.showsNodeCount = YES;
Just comment these two lines or do this:
你可以评论这两句话,或者这样做:
skView.showsFPS = NO;
skView.showsNodeCount = NO;
Hope this helps.. :)
希望这可以帮助. .:)
#2
2
In Swift, you go to GameScene.swift, look at "skView.showsFPS" and "skView.showsNodeCount" repair from "true" to "false". Nodes and FPS will be removed at bottom of the screen! good luck
在《Swift》中,你会去GameScene。迅速,看看“skView。showsFPS”和“skView。显示“修理”从“真”到“假”。节点和FPS将在屏幕底部被删除!祝你好运
#3
1
Set spriteView.showsDrawCount=NO
and check once. I think you have not set it to NO.
设置spriteView。showsDrawCount = NO和检查一次。我认为你没有把它设置为NO。
#4
1
You could use a DEBUG
compiler directive, so this debugging label info is visible during development, but doesn't get included in the App Store release build.
您可以使用调试编译器指令,这样调试标签信息在开发过程中是可见的,但是不会包含在App Store发行版中。
// GameViewController.swift
override func viewDidLoad() {
super.viewDidLoad()
let scene = self.sceneManager.scene
scene.gameDelegate = self
let skView = self.view as! SKView
skView.ignoresSiblingOrder = true
#if DEBUG
skView.showsFPS = true
skView.showsNodeCount = true
#endif
skView.presentScene((scene as! SKScene))
}
#1
14
-(id)initWithSize:(CGSize)size
is not the method where you do this. I guess you are doing this in subclass of SKScene
. You should do it in ViewContoller
. Go to the ViewController
there in viewWillLayoutSubviews
. Just find that somewhere in your code you did this:
-(id)initWithSize:(CGSize)size不是这样做的方法。我猜你是在SKScene的子类中做这个。你应该在ViewContoller中执行。到viewWillLayoutSubviews中的ViewController。在你的代码中找到这样做的地方:
skView.showsFPS = YES;
skView.showsNodeCount = YES;
Just comment these two lines or do this:
你可以评论这两句话,或者这样做:
skView.showsFPS = NO;
skView.showsNodeCount = NO;
Hope this helps.. :)
希望这可以帮助. .:)
#2
2
In Swift, you go to GameScene.swift, look at "skView.showsFPS" and "skView.showsNodeCount" repair from "true" to "false". Nodes and FPS will be removed at bottom of the screen! good luck
在《Swift》中,你会去GameScene。迅速,看看“skView。showsFPS”和“skView。显示“修理”从“真”到“假”。节点和FPS将在屏幕底部被删除!祝你好运
#3
1
Set spriteView.showsDrawCount=NO
and check once. I think you have not set it to NO.
设置spriteView。showsDrawCount = NO和检查一次。我认为你没有把它设置为NO。
#4
1
You could use a DEBUG
compiler directive, so this debugging label info is visible during development, but doesn't get included in the App Store release build.
您可以使用调试编译器指令,这样调试标签信息在开发过程中是可见的,但是不会包含在App Store发行版中。
// GameViewController.swift
override func viewDidLoad() {
super.viewDidLoad()
let scene = self.sceneManager.scene
scene.gameDelegate = self
let skView = self.view as! SKView
skView.ignoresSiblingOrder = true
#if DEBUG
skView.showsFPS = true
skView.showsNodeCount = true
#endif
skView.presentScene((scene as! SKScene))
}