ios - iAd restarts game when it pops up -
You start my app again when it pops the iAd banner it will restart the game it will go normally so suddenly run Back to all the progress on the Start Title screen: This is my ViewController.h And this ViewController.m Put an NSLog there to verify it. If so, then try moving everything in
#import & lt; UIKit / UIKit.h & gt; #important & lt; Spritekit / Spritekit H & gt; The @interface ViewController: UIViewController @end
#import "ViewController.h" #import "MyScene.h" # import & Lt; IAd / iAd.h & gt; @ Interface view controller () & lt; ADBannerViewDelegate & gt; @property (nonatomic, strong) ADBannerView * banner; @end @implementation ViewController - (minus) bannerView: (ADBannerView *) banner didFailToReceiveAdWithError: (NSError *) error {if (banner.isBannerLoaded) {[UIView beginAnimations: @ "animateAdBannerOff" context: nil]; // Assume that the banner is placed at the bottom of the screen. Banner.frame = cgffset (banner.frame, 0, banner.frame.edight.height); [UIView commitAnimations]; }} - (void) bannerViewDidLoadAd: (ADBannerView *) banner {if (banner.isBannerLoaded!) {[UIView beginAnimations: @ "animateAdBannerOn" context: nil]; // Assume that the banner is at the bottom of the screen. Banner.frame = CGRectOffset (banner.frame, 0, -banner.frame.size.height); [UIView commitAnimations]; }} - (zero) viewDidoad {[Super Viewedload]; // View Configure SKView * skView = (SKView *) self.view; SkView.showsFPS = No; SkView.showsNodeCount = No; // Create and configure view SKEsine * View = [Size with MyScene view: skView.bounds.size]; Scene.scaleMode = SKSceneScaleModeAspectFill; // present the scene [SkView presentScene: view]; } - (Zero) View GameLayoutView Visual [{Super ViewWall LightsSubview]; Self.banner = [[ADBannerView alloc] initWithFrame: CGRectZero]; Self.banner.delegate = self; [Self. Banner size tofitt]; Self.canDisplayBannerAds = Yes; SKView * View = (SKView *) self.originalContentView; Skesin * scene = [[Maissen light] Init with Sisijh: Sijisijhmek (Self. V. U.a.frem. Size.width, self.view.frame.size.height)]; [View current] View: view]; } - (BOOL) should be metatitive {return yes; } - (Ansuintegr) on supported interfaces Orenteshn {if ([[Uaidiivis device] User Intrfesaidiom] == UI user interface Aidiofonfon) {return Uaiantifereshnorenteshnmask Sbbut Upisdaun down; } And {return UIInterfaceOrientationMaskAll; }} - (zero) done rescue memorisation {[super dysrhymmy warning]; // Use any cached data, images, etc. which are not in use. } I think call to
viewWillLayoutSubviews
@end viewDidAppear
or viewWillAppear
instead.
Comments
Post a Comment