I implement successfully admob banner ads in my ios game with cocos2d-x 2.2.2
I use the following code inside AppController.mm
NSLog(@"%f - %f - %f - ",bannerWidth,bannerHeight,window.frame.size.height);
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:CGPointMake( 0 , 0)];
bannerView_.delegate = self;
bannerView_.adUnitID = @"ca-app-pub-8707318716621254/7164825544";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = viewController;
adRequest = [self request];
It's works for me.
But I want to hide the banner ad in some parts of my game, like I do it in android platform.
I try everything that I could find to remove the bannerView_ from admob, but none of them work
bannerView_ = nil;
I think it's because I add admob banner as a subview, but I have no idea how to make this work.
Any help will be appreciated.