How to stop Sprite Kit from reinitializing the scene with iAd banner

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?

Answers


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.


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.


Need Your Help

cakePHP - Associated Model validation

php jquery ajax validation cakephp

I have a validate_form() function which is called through ajax, which should validate input fields of an associated model from an action belonging to the main model..

Android Screencast fails (please help a new Android Dev)

java android security certificate signing

I'm setting up new AndroidDevEnvironment and I'm stuck on this error while trying to open Android Screencast which allows you to use your android device via PC via keyboard and mouse and display