GoogleInteractiveMediaAds Framework Reference

IMAAdDisplayContainer

@interface IMAAdDisplayContainer : NSObject

The IMAAdDisplayContainer is responsible for managing the ad container view and companion ad slots used for ad playback.

  • View containing the video display and ad related UI. This view must be present in the view hierarchy in order to make ad or stream requests.

    Declaration

    Swift

    var adContainer: UIView { get }

    Objective-C

    @property (readonly, nonatomic) UIView *_Nonnull adContainer;
  • List of companion ad slots. Can be nil or empty.

    Declaration

    Swift

    var companionSlots: [IMACompanionAdSlot]? { get }

    Objective-C

    @property (readonly, nonatomic, nullable) NSArray<IMACompanionAdSlot *> *companionSlots;
  • Initializes IMAAdDisplayContainer for rendering the ad and displaying the ad UI without any companion slots.

    Declaration

    Swift

    init(adContainer: UIView)

    Objective-C

    - (nonnull instancetype)initWithAdContainer:(nonnull UIView *)adContainer;

    Parameters

    adContainer

    The view where the ad will be rendered. Fills the view’s bounds.

    Return Value

    A new IMAAdDisplayContainer instance

  • Initializes IMAAdDisplayContainer for rendering the ad and displaying the ad UI.

    Declaration

    Swift

    init(adContainer: UIView, companionSlots: [IMACompanionAdSlot]?)

    Objective-C

    - (nonnull instancetype)initWithAdContainer:(nonnull UIView *)adContainer
                                 companionSlots:
                                     (nullable NSArray<IMACompanionAdSlot *> *)
                                         companionSlots;

    Parameters

    adContainer

    The view where the ad will be rendered. Fills the view’s bounds.

    companionSlots

    The array of IMACompanionAdSlots. Can be nil or empty.

    Return Value

    A new IMAAdDisplayContainer instance

  • Registers a view that overlays or obstructs this container as “friendly” for viewability measurement purposes.

    See Open Measurement in the IMA SDK for guidance on what is and what is not allowed to be registered.

    Declaration

    Swift

    func register(_ friendlyObstruction: IMAFriendlyObstruction)

    Objective-C

    - (void)registerFriendlyObstruction:
        (nonnull IMAFriendlyObstruction *)friendlyObstruction;

    Parameters

    friendlyObstruction

    An obstruction to be marked as “friendly” until unregistered.

  • Unregisters all previously registered friendly obstructions.

    Declaration

    Swift

    func unregisterAllFriendlyObstructions()

    Objective-C

    - (void)unregisterAllFriendlyObstructions;