10131

iAd ADBannerView detect unloading

Question:

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!

Answer1:

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; }]; }

Recommend

  • bad argument #1 to 'ipairs' (table expected, got boolean)
  • Laravel - Eloquent Create or Update Model
  • Intent to Hidden Application on Android
  • Time Complexity of the given nested loops
  • Is there a way to maintain a 200MB immutable data structure in memory and access it from a script?
  • Round number to nearest “nth” based on first non zero
  • failed: dlopen failed: cannot locate symbol “signal” referenced by “libSDL2.so”
  • Density Value for each Return
  • ios - navigationItem.titleView blinks when updated
  • How can I join lazy translation in Django?
  • How to put different size vectors in data.table column
  • Drawing a Polygon
  • How to get rows with min values in one column, grouped by other column, while keeping other columns?
  • I want to trace logs using a Macro multi parameter always null. problem c++ windows
  • Form Authentication in Ktor
  • Failed to update work status Exception in Python Cloud Dataflow
  • Warning: ldap_start_tls() [function.ldap-start-tls]: Unable to start TLS: Server is unavailable
  • Creating new docker-machine instance always fails validating certs using openstack driver
  • Converting float[,] to list in f#?
  • Interpolation method that does not add unnecessary extremums
  • Mocking Non-Standard Events in F# Foq
  • data.table replicate rows after join?
  • Detection of framework usage on Mac system?
  • How to discover Font Type?
  • Debugging VB6 Code From Visual Studio 2010
  • Excel's Macro-Recorder usage
  • How to use carriage return with multiple line?
  • java inputstream
  • Ajax Loaded meta Tags
  • Weird JavaScript statement, what does it mean?
  • Data Validation Drop Down Box Arrow Disappearing
  • File upload with ng-file-upload throwing error
  • Free memory of cv::Mat loaded using FileStorage API
  • Java static initializers and reflection
  • need help with bizarre java.net.HttpURLConnection behavior
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF