Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Game with Sprite Kit Game Loop and Texture Atlas Adding a Title Scene

ViewDidLayoutSubViews is not working pleas tell me what is wrong I am using Xcode 6 2015

It does not work it stays the same when I call this method

Omar Nunez
Omar Nunez
4,101 Points

Put more info of your code

Jeff Ripke
Jeff Ripke
41,989 Points

I downloaded the code and used the code in the THViewController.m file and put it in GameViewController.m file and it worked. I hope this helps.

1 Answer

Jacob this might help.. Not sure if you solved the issue yet.

@implementation GameViewController -(void)viewDidLayoutSubviews { [super viewDidLayoutSubviews];

   // Configure the view.
   SKView *skView = (SKView *)self.view;
   skView.showFPS = YES;
   sk.View.showsNodeCount = YES;

   sk.View.ignoresSiblingOrder = YES;

  GameScene *scene = [GameScene sceneWithSize:skView.bounds.size];
  scene.scaleMode = SKSceneScaleModeAspectFill;

  [skView presentScene:scene];

}

......

Note: Will work with

-(void)viewDidLoad { [super viewDidLoad];

..............................