Answer the question
In order to leave comments, you need to log in
SpriteKit (Objective-c): what to do if the banners visible in one scene are visible in all scenes when switching to it?
I inserted banners in the Game Over scene but after jumping to that scene, the banners show up in all scenes in the game.
I have the banner code in the main GameViewController. To load a banner in my scene, I inserted this code before the scene declaration:
- (void)loadAdBanner {
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
GameViewController *vc = (GameViewController *)delegate.window.rootViewController;
[vc initADBanner];
}
GameScene * myScene = [[ GameScene alloc ] initWithSize : self.view.bounds.size ];
[ self.view presentScene: myScene ];
Answer the question
In order to leave comments, you need to log in
As far as I know, SpriteKit does not use other controllers. The root controller itself loads all the scenes. Therefore, if you force it to show your banner, it will show it regardless of the scene currently being shown. Try to shift the mechanism of creating a banner and the view that shows it to a specific scene where it is required.
Thanks, exhaustive. I suspected this, but in all the demos and examples, banners are loaded into the root controller. until I can't properly organize the methods in a particular scene. I get errors all the time, even when I'm 100% sure the code is correct.
Thanks for responding.
This service will help you , I myself constantly use the @font-face generator
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question