Wiki

Clone wiki

Banner Sample / AATKit 3 multi-size banner migration

Multi-Size Banner Placement

Index:

  1. Multi-Size Banner
  2. Creating a Multi-Size Banner
  3. Requesting an Ad
  4. Listening to events
  5. Displaying a Multi-Size Banner

Multi-Size banner placements can present banner of varying sizes. For instance it is possible to display a banner of the standard size 320x53, followed by a medium rect angle of size 300x250 within the same placement.

MSB_inApp_example.png

(Note: the green background is an ad container (UIView), into which the placement view is added. It represents the space that is reserved for a multi-size banner placement's view.)

Meta Information

The following sizes are supported for Multi-Size Banner.

  1. 300x250
  2. 320x53
  3. 320x75 (DFP only)
  4. 320x100 (DFP only)
  5. 320x150 (DFP only)
  6. 468x60
  7. 768x90

Please contact the AddApptr support via support@addapptr.com, in order to let us know which formats you would like to use in your app. The AddApptr team will setup the backend accordingly.

Creating a Multi-Size Banner

A Multi-Size Banner is created by calling the method:

Instead of:

#!objective-c

+ (nonnull id) createPlacementWithName:(nonnull NSString *) placementName andType:(AATKitAdType)type

Use:

#!swift

public static func createMultiSizeBannerPlacement(name: String) -> AATMultiSizeBannerPlacement?

This process is just the same as for the normal banner placement.

Instead of:

Objective-C:

#!objective-c
[AATKit createPlacementWithName:@"MultiSizeBanner" andType:AATKitBannerMultiSize];
Swift:
#!swift
AATKit.createPlacement(withName: "MultiSizeBanner", andType: .bannerMultiSize)

Use:

Objective-C:

#!objective-c
[AATSDK createMultiSizeBannerPlacementWithName:@"MultiStickyBanner"];
Swift:
#!swift
AATSDK.createMultiSizeBannerPlacement(name: "MultiStickyBanner")

Requesting an Ad

A Multi-Size Banner supports manual and automatic reload. For manual reload:

Instead of:

#!objective-c
+ (bool) reloadPlacement:(nonnull id) placement;

Use:

placement.reload()

For automatic reload:

Instead of:

#!objective-c
+ (void) startPlacementAutoReload:(nonnull id) placement;

Use:

placement.startAutoReload()

Listening to events

To register for multisize banner ad events, set the delegate property on AATMultiSizeBannerPlacement to an object that implements the AATMultiSizeBannerPlacementDelegate protocol.

Objective-C:

[self.placement setDelegate:self];

Swift:

placement.delegate = self

Implementing AATStickyBannerPlacementDelegate

    func aatHaveAdWithBannerView(bannerView: AATBannerPlacementWrapperView) {
        /// This method will be called when there is an ad
    }

    func aatNoAd() {
        /// This method will be called when there is no ad available
    }

    func aatAdCurrentlyDisplayed() {
        /// This method will be called with the ad display event
    }

    func aatResumeAfterAd() {
        /// This method will be called when the app resumes after displaying an ad
    }

Displaying a Multi-Size Banner

In order to show a Multi-Size Banner, its view has to be positioned on the screen, similar to regular banner placements. Since a new placement view is provided each time the Multi-Size Banner specific callback is invoked, a potential previous placement view has to be disposed by the programmer, and a new one has to be positioned. Since the UIView frame can change each time Multi-Size Banner callback is invoked the programmer has to adapt the space available according to the view's frame.

Updated