MSU_Bulldog MSU_Bulldog - 2 months ago 12
iOS Question

Sprite Kit: Remove debugging label at bottom corner

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)

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?

SKView *spriteView = (SKView *) self.view;
spriteView.showsNodeCount = NO;
spriteView.showsFPS = NO;

Answer

-(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:

skView.showsFPS = YES;
skView.showsNodeCount = YES;

Just comment these two lines or do this:

skView.showsFPS = NO;
skView.showsNodeCount = NO;

Hope this helps.. :)