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 7885299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:01:36+00:00 2026-06-03T05:01:36+00:00

I have an app with multiple UITableViews and am in the process of implementing

  • 0

I have an app with multiple UITableViews and am in the process of implementing iADs. Per the Apple documentation (http://developer.apple.com/library/ios/#technotes/tn2286/_index.html#//apple_ref/doc/uid/DTS40011212) I have created a shared banner that belongs to my app delegate and the application delegate is also the banner’s delegate. This works well and the ads show nicely across the various view controllers AFTER the banner is loaded and the user switches screens.

The problem is that there is no ad seen on the first viewController that comes up because the viweWillAppear method of the view controller (where I am calling my “fixUpAdView” method) comes before the banner is loaded.

I guess the part that I am not getting is this (from the apple documentation):
“Have your application delegate tell the current view controller if it should show or hide the banner. You can use UINavigationControllerDelegate or UITabBarControllerDelegate protocol to push the banner to show it.” I understand that I need to be putting something into my bannerViewDidLoadAd and failToReceive methods but am a bit confused as to how to do this.

I do not want the ad to show on all of my view controllers (just 6 of them) and I also have several modal views in the app (no ad on any of these).

Here is some of my code:
In my appDelegate:

- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
    NSLog(@"bannerViewDidLoadAD");
    if (!_adBannerViewIsVisible) 
        _adBannerViewIsVisible = YES;

}


- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{

    NSLog(@"BannerAd didfailtoreceive");
    if (_adBannerViewIsVisible)
        _adBannerViewIsVisible = NO;

}

- (ADBannerView *)sharedAdBannerView 
{
    if (_sharedAdBannerView == nil) {

        Class classAdBannerView = NSClassFromString(@"ADBannerView");

        if (classAdBannerView != nil) {
            _sharedAdBannerView = [[classAdBannerView alloc] initWithFrame:CGRectZero];
            [_sharedAdBannerView setRequiredContentSizeIdentifiers:[NSSet setWithObjects: 
                                                              ADBannerContentSizeIdentifier320x50, 
                                                              ADBannerContentSizeIdentifier480x32, nil]];
            [_sharedAdBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifier320x50];            
            [_sharedAdBannerView setFrame:CGRectOffset([_sharedAdBannerView frame], 0, 
                                                 -(iAD_BANNER_HEIGHT))];
            [_sharedAdBannerView setDelegate:self];
        }
    }

    return _sharedAdBannerView;
}

In my view controller:

- (void)viewWillAppear:(BOOL)animated {

    if ([[AppDelegate ad] shouldShowAds]) {

        if (!self.contentView) {
            self.contentView = [[UIView alloc] initWithFrame:[[self view] bounds]];
            [self.view addSubview:_contentView];
        }
        [self.contentView addSubview:topView];
        [self fixupAdView];
        [self.view addSubview:[[AppDelegate ad] sharedAdBannerView]];
    }
    [super viewWillAppear:NO];
}


#pragma mark
#pragma mark iADS

- (void)fixupAdView {

    if ([[AppDelegate ad] sharedAdBannerView] != nil) {        

        [[[AppDelegate ad] sharedAdBannerView] setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifier320x50];
        [UIView beginAnimations:@"fixupViews" context:nil];

        if ([[AppDelegate ad] adBannerViewIsVisible]) {
            CGRect adBannerViewFrame = [[[AppDelegate ad] sharedAdBannerView] frame];
            adBannerViewFrame.origin.x = 0;
            adBannerViewFrame.origin.y = 0;
            [[[AppDelegate ad] sharedAdBannerView] setFrame:adBannerViewFrame];
            CGRect contentViewFrame = _contentView.frame;
            contentViewFrame.origin.y = iAD_BANNER_HEIGHT;
            contentViewFrame.size.height = self.view.frame.size.height - 
            iAD_BANNER_HEIGHT;
            _contentView.frame = contentViewFrame;
        } 
        else {
            CGRect adBannerViewFrame = [[[AppDelegate ad] sharedAdBannerView] frame];
            adBannerViewFrame.origin.x = 0;
            adBannerViewFrame.origin.y = -(iAD_BANNER_HEIGHT);
            [[[AppDelegate ad] sharedAdBannerView] setFrame:adBannerViewFrame];
            CGRect contentViewFrame = _contentView.frame;
            contentViewFrame.origin.y = 0;
            contentViewFrame.size.height = self.view.frame.size.height;
            _contentView.frame = contentViewFrame;            
        }
        [UIView commitAnimations];
    }   
}
  • 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-03T05:01:38+00:00Added an answer on June 3, 2026 at 5:01 am

    Using NSNotificationCenter to solve this problem worked like a charm and now my iAds are coming up as soon as they are loaded – yay! If anyone else needs this here is the extra code I input:
    (in my appDelegate.m)

    - (void)bannerViewDidLoadAd:(ADBannerView *)banner {
    NSLog(@"bannerViewDidLoadAD");
    if (!_adBannerViewIsVisible) {
        _adBannerViewIsVisible = YES;
        [[NSNotificationCenter defaultCenter] postNotificationName:@"adjustAdBannerView" object:nil];
    }
    

    }

    - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
    

    {

     NSLog(@"BannerAd didfailtoreceive");
    if (_adBannerViewIsVisible) {
        _adBannerViewIsVisible = NO;
        [[NSNotificationCenter defaultCenter] postNotificationName:@"adjustAdBannerView" object:nil];
    }
    

    }

    and in my View Controller (in viewWillAppear):

    [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(fixupAdView)
                                                     name:@"adjustAdBannerView"
                                                   object:nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple UITableViews in my app, is there a method of detecting which
I have an app with multiple subdomains, subone.parent.com, subtwo.parent.com. I have a logon page
I have WinForms app and multiple forms and want to use ErrorProvider component on
I have an app that sends multiple Ajax requests simultaneously. I was originally running
I have a Django app where multiple teams upload content that will be parsed.
I have CakePHP app in which I'd like to attach gallery to multiple resources.
I currently have an app that requires connection to a server in multiple activities.
I have a Django app and I am trying to perform transactions over multiple
We have multiple config files (app.DEV.config, app.TEST.config, etc) and a pre-build event that copies
I have multiple UIButtons in my app. I also use interfacebuilder. In my .h

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.