arc4randall
arc4randall

Reputation: 3293

Removing an iad View

I am trying to implement iad within my iOS game. I simply want to diplay the iAd during the menu of the game, but not anywhere else. I have tried several methods for removing the banner, but none have worked for me. I have an AdBannerView property within my view called advertisement, and I am able to successfully create an iad when the user opens the menu, however, when they close the menu, the iAd is still displayed. Here are the things I have tried:

-(void)menuDidClose{
[self.advertisement setAlpha:0];
self.advertisement.hidden = YES;
self.advertisement = nil;
[self.advertisement cancelBannerViewAction];
[self.view sendSubviewToBack:self.advertisement];
[self.advertisement removeFromSuperview];
}

None of that has worked for me so far. Any other suggestions? I can get the iad to display, but not to disappear when I close the menu.

Upvotes: 2

Views: 157

Answers (1)

Shiva
Shiva

Reputation: 176

Try this: Setting bannerview object to 'nil' will delete this object (ARC) and banner-ads will stop displaying.

[self.advertisement removeFromSuperview];
self.advertisement = nil;

Upvotes: 0

Related Questions