Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8547681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:19:05+00:00 2026-06-11T13:19:05+00:00

I am using Google AdMob for iOS: Google AdMob I was wondering whether I’m

  • 0

I am using Google AdMob for iOS:

Google AdMob

I was wondering whether I’m able to turn off these ads programmatically so they stop displaying. After reading through the SDK I can’t see anywhere to toggle the ads on or off.

EDIT:

This is how I load the Google AdMob code:

MainViewController.m

- (void) viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    // Create a view of the standard size at the bottom of the screen.
    // Available AdSize constants are explained in GADAdSize.h.
    bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
    // Must be a better way to position at bottom of page
    [bannerView_ setCenter:CGPointMake(kGADAdSizeBanner.size.width/2, 455)];
    // Specify the ad's "unit identifier." This is your AdMob Publisher ID.
    bannerView_.adUnitID = MY_BANNER_UNIT_ID;
    // 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 = self;
    [self.view addSubview:bannerView_];

    // Initiate a generic request to load it with an ad.
    GADRequest *request = [GADRequest request];
    // remove this line when you are ready to deploy for real
    request.testing = YES;
    [bannerView_ loadRequest:request];
}

I’d like to disable the superview within a class implementation:

This is the code I’ve tried so far to loop through the MainViewController subviews.

Once I’ve found the right subview GADBannerView I want to be able to remove it.

OtherClass.m

- (void)disableAds
{
    // Turn the ads off.
    UIViewController *mainView = [[UIViewController alloc] initWithNibName:@"MainViewController" bundle:[NSBundle mainBundle]];
    for (UIView *subview in [mainView.view subviews]) {
        NSLog(@"View(s): %@", subview);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:19:06+00:00Added an answer on June 11, 2026 at 1:19 pm

    Because the class implementation was actually a plugin I was able to use the following code:

    for (UIView *subview in [self.viewController.view subviews]) {
        if([subview isKindOfClass:[GADBannerView class]]) {
            [subview removeFromSuperview];
        }
    }
    

    According to Phonegap documentation, every plugin has a self.viewController property. So it was just a matter of looping through and removing only the GADBannerView from the superview.

    Of course I had to #import "GADBannerView.h" in the plugin class implementation first so it knew about GADBannerView.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While using Google chrome if I shut down it unexpectedly. like turn of pc
Using Google Checkout, I'm able to estimate tax based on the zip code that's
I am using google admob in my application. I have the following code: GADRequest
I'm adding adMob provide by google to my iOS app and I'm stuck on
Using Google's Hello TabWidget tutorial found here I was able to build a tabWidget
I am trying to add ads to my Android app using Admob, but have
I have a project that uses the Google AdMob Ads SDK. I'm trying to
Using Google AppScript. How could I find the checked RadioButton in a group? If
Using Google App Engine, I am trying to urlfetch a gzip file from a
Using Google Apps Script, I've made a UI for use on a Google Spreadsheet.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.