Question

I made a game using sprite kit in landscape mode. The only allowed orientations are landscape left and landscape right. When I select the banner ad in my game, rather than freezing the scene and returning to the original point in the game, the entire scene reinitializes itself (music player restarts, content shows as start screen, etc).

The same thing happens when I flip the phone around so that the orientation switches. How can I prevent this?

Was it helpful?

Solution 2

Thanks for the response. That was the problem. I had been initializing the scene in the viewWillLayoutSubviews method in my root view controller. I moved the scene initialization to the viewDidLoad method and it fixed the issue.

OTHER TIPS

As for when you flip your phone you need this...

- (void)viewWillLayoutSubviews { 

[super viewWillLayoutSubviews];
SKView * skView = (SKView *)self.view;

if ( !skView.scene ) {...

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

    [skView presentScene:scene]; 
    } 
}

I'm still looking into the iAd issue, I'll update if I figure anything out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top