SASBannerViewDelegate

Objective-C

@protocol SASBannerViewDelegate <NSObject>

Swift

protocol SASBannerViewDelegate : NSObjectProtocol

SASBannerView delegate.

  • Called when the banner view has loaded an ad successfully.

    Declaration

    Objective-C

    - (void)bannerView:(nonnull SASBannerView *)bannerView
        didLoadWithInfo:(nonnull SASAdInfo *)adInfo;

    Swift

    func bannerView(_ bannerView: SASBannerView, didLoadWith adInfo: SASAdInfo)

    Parameters

    bannerView

    The instance of SASBannerView calling the delegate.

    adInfo

    The instance of SASAdInfo related to the loaded ad.

  • Called when the banner view fails to load the ad.

    Declaration

    Objective-C

    - (void)bannerView:(nonnull SASBannerView *)bannerView
        didFailToLoadWithError:(nonnull NSError *)error;

    Swift

    func bannerView(_ bannerView: SASBannerView, didFailToLoad error: any Error)

    Parameters

    bannerView

    The instance of SASBannerView calling the delegate.

    error

    The error preventing the banner from being loaded.

  • Called when a valid click is registered on the banner view.

    Declaration

    Objective-C

    - (void)bannerViewClicked:(nonnull SASBannerView *)bannerView;

    Swift

    optional func bannerViewClicked(_ bannerView: SASBannerView)

    Parameters

    bannerView

    The instance of SASBannerView calling the delegate.

  • Called when the banner expand as a fullscreen view controller.

    This can happen with some interactive creatives like MRAID HTML creatives, Video-Read or when displaying ads from a third party SDK through the SASBannerView.

    Declaration

    Objective-C

    - (void)bannerViewDidExpand:(nonnull SASBannerView *)bannerView;

    Swift

    optional func bannerViewDidExpand(_ bannerView: SASBannerView)

    Parameters

    bannerView

    The instance of SASBannerView calling the delegate.

  • Called when the banner collapse back as a non fullscreen view.

    Declaration

    Objective-C

    - (void)bannerViewDidCollapse:(nonnull SASBannerView *)bannerView;

    Swift

    optional func bannerViewDidCollapse(_ bannerView: SASBannerView)

    Parameters

    bannerView

    The instance of SASBannerView calling the delegate.

  • Called when the banner requests to be closed.

    Note

    Some ad formats might want to close the banner ad by themself (for instance some video ads). It is the app responsability to actually close the banner ad, aka to remove it from the views’ hierarchy. If the app does nothing or does not implement this delegate, the ad will not be closed.

    Declaration

    Objective-C

    - (void)bannerViewDidRequestClose:(nonnull SASBannerView *)bannerView;

    Swift

    optional func bannerViewDidRequestClose(_ bannerView: SASBannerView)

    Parameters

    bannerView

    The instance of SASBannerView requesting to be closed.

  • Called when the banner starts audio playback.

    Note

    Implement this method if your app also plays audio: pause your player while the ad is playing its own audio and start it back when the ad is finished.

    Declaration

    Objective-C

    - (void)bannerViewWillStartAudioPlayback:(nonnull SASBannerView *)bannerView;

    Swift

    optional func bannerViewWillStartAudioPlayback(_ bannerView: SASBannerView)

    Parameters

    bannerView

    The instance of SASBannerView playing the audio.

  • Called when the banner stops audio playback.

    Note

    Implement this method if your app also plays audio: pause your player while the ad is playing its own audio and start it back when the ad is finished.

    Declaration

    Objective-C

    - (void)bannerViewDidStopAudioPlayback:(nonnull SASBannerView *)bannerView;

    Swift

    optional func bannerViewDidStopAudioPlayback(_ bannerView: SASBannerView)

    Parameters

    bannerView

    The instance of SASBannerView stoping audio playback.