1

If you add an ADBannerView you can detect when it loads an AD from its delegate function:

- (void)bannerViewDidLoadAd:(ADBannerView *)banner {

This can be helpful if you have views below the banner that you need to move or resize when the banner loads.

I coudn't find any way to detect when the banner is disappearing to move back again all the views in place.

The delegate has only these functions:

Detecting When Advertisements Are Loaded

– bannerViewWillLoadAd:
– bannerViewDidLoadAd:

Detecting When a User Interacts With an Advertisement

– bannerViewActionShouldBegin:willLeaveApplication:
– bannerViewActionDidFinish:

Detecting Errors

– bannerView:didFailToReceiveAdWithError:

Nothings seems to get triggered when the banner unloads.

Any way to detect the banner unload or any workarounds? Thanks!

ksn
  • 623
  • 2
  • 6
  • 18
  • 1
    I use `- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error` to detect when the banner is unload and it's fine – Jordan Montel Sep 30 '13 at 15:07

1 Answers1

2

I use bannerViewDidLoadAd when a banner is load and so show this banner with an animation

#pragma mark - ADBannerViewDelegate
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    NSLog(@"banner loaded");

    // Display BannerView
    _iAdBannerView.hidden = NO;
    [UIView animateWithDuration:0.4f
                     animations:^{
                         _iAdBannerView.alpha = 1.0f;
                     }];
}

And I use didFailToReceiveAdWithError when the banner is unload (so here, you can add an animation to move your view for example) :

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    // Print error
    NSLog(@"error banner failed :\n%@", error);

    // Hide BannerView
    [UIView animateWithDuration:0.4f
                     animations:^{
                         _iAdBannerView.alpha = 0.0f;
                     } completion:^(BOOL finished) {
                         _iAdBannerView.hidden = YES;
                     }];
}
Jordan Montel
  • 8,227
  • 2
  • 35
  • 40