It does not make sense to initialize the scene in the layout handler. Resize the scene in the layout handler. (What is this for.)
@implementation SGOMyScene { SKScene *scene; } - (void)viewDidLoad { [super viewDidLoad]; SKView *skView = (SKView *)self.view; skView.showsFPS = YES; skView.showsNodeCount = YES; scene = [SGOMyScene sceneWithSize:skView.bounds.size]; scene.scaleMode = SKSceneScaleModeAspectFill; [skView presentScene:scene]; } - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; SKView *skView = (SKView *)self.view; scene.size = skView.bounds.size; }
Your scene should implement - (void)didChangeSize:(CGSize)oldSize to move everything to the right place.
Hooray, now your game also handles the rotation of the device.
source share