Reputation: 23
I have this SpriteKit app where I want to have a add show up on the main menu, and when the player dies. I already have NSNotifiactions setup. I just want to know how to toggle the visibility of the iAd.
I have tried 3 things:
Alpha - I was told this would work but it didn't:
[banner setAlpha:0]
"self.canDisplayBannerAds":
self.canDisplayBannerAds=NO;
Removing Banner from subview:
[banner removeFromSuperview]
Sounds kinda weird right? If you know please write an answer!
Upvotes: 0
Views: 63
Reputation:
for example
ViewController.m
@import <iAd>;
@interface ViewController () <GameSceneDelegate,ADBannerViewDelegate>
_bannerView = [[ADBannerView alloc] initWithAdType:ADAdTypeBanner];
_bannerView.frame = CGRectMake(0, self.view.frame.size.height - _bannerView.frame.size.height, self.view.frame.size.width, _bannerView.frame.size.height);
_bannerView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleWidth;
_bannerView.delegate = self;
[self.view addSubview:_bannerView];
if you want to hide ad use this: _bannerView.hidden = YES;
Upvotes: 1