Banner

Banner ads are rectangular image or text ads that occupy a space inside the application layout. They stay on screen while the users interact with the app and can automatically refresh after a certain period of time. If you are new in mobile advertising, they are an excellent choice to start.

Integration

To integrate a banner, it is needed to add a WABannerAd class component to the app interface.

Then, an ad load should be requested just as shown in the example below:

import UIKit
import WortiseSDK

class ViewController: UIViewController {
    @IBOutlet
    weak var bannerAd: WABannerAd!

    override func viewDidLoad() {
        super.viewDidLoad()
        ...
        bannerAd.adUnitId = "Wortise Ad Unit ID"
        bannerAd.adSize = WAAdSize.height50
        bannerAd.rootViewController = self
        // Optional: value in seconds to auto-refresh the ad
        bannerAd.autoRefreshTime = 60.0
        bannerAd.loadAd()
    }
}

Adaptive banners

Adaptive banners are a new banner format where the size of the ads is adapted according to the device and the app user-interface, in order to maximize performance.

Currently there is support for two kind of adaptive banners:

Anchored

This kind of banner is designed to replace the traditional 320x50 banners and be positioned at the top or bottom of the screen.

To make use of this format, the following code must be used to configure an adaptive size:

Alternatively, this other option can be implemented to let the SDK calculate the banner width, where the WABannerAd instance itself or the UIView that will contain it should be passed:

Inline

This other kind of banner, in comparison to the anchored, is designed to have a variable height and be positioned inside a scrolling content.

In this case, the following code must be used to configure a proper adaptive size:

Alternatively, this other option can be implemented to let the SDK calculate the banner width, where the WABannerAd instance itself or the UIView that will contain it should be passed:

Delegate setup

A listener can be set to any WABannerAd instance to receive the events that happen during its lifecycle. For this, it is needed to implement the WABannerDelegate interface as shown in the example below:

Once the interface is implemented, the delegate is assigned to the ad instance:

Última actualización