It sounds like the constraints of the view haven't been resolved yet when your view configuration code kicks in. That is, the frames at that time do not correspond the "real" layout that you have created using auto layout constraints (which should fit the skView
to the view
).
I have moved the code from viewWillAppear
to viewDidLayoutSubviews
instead and it turns out that, at this time of the layout process, the bounds of your view
and skView
have been updated and it seems to work for both 3.5" and 4" screens.
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
CGSize skViewSize = self.skView.bounds.size;
SKScene *scene = [MyScene sceneWithSize:skViewSize];
scene.scaleMode = SKSceneScaleModeAspectFill;
[self.skView presentScene:scene];
}
This tutorial might shed some more light on the topic.
Btw, I have submitted a pull request with my changes to your sample repository so you can browse the change.