# IMAAdDisplayContainer

    @interface IMAAdDisplayContainer : NSObject

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


  ### [adContainer](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdDisplayContainer#/c:objc(cs)IMAAdDisplayContainer(py)adContainer)


  ` 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 (nonatomic, readonly) UIView *_Nonnull adContainer;

- `


  ### [adContainerViewController](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdDisplayContainer#/c:objc(cs)IMAAdDisplayContainer(py)adContainerViewController)


  ` View controller containing the ad container. Used to present ad UI in child view controllers. It
  must be non-nil in order to make ad or stream requests, and it must be in the view hierarchy
  before ad playback.

  #### Declaration

  Swift

      weak var adContainerViewController: UIViewController? { get set }

  Objective-C

      @property (nonatomic, weak, nullable) UIViewController *adContainerViewController;

- `


  ### [focusEnvironment](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdDisplayContainer#/c:objc(cs)IMAAdDisplayContainer(py)focusEnvironment)


  ` The environment to focus on during an ad break. Nil if there is not currently an ad break.

  #### Declaration

  Swift

      var focusEnvironment: (any UIFocusEnvironment)? { get }

  Objective-C

      @property (nonatomic, readonly, nullable) id<UIFocusEnvironment> focusEnvironment;

- `


  ### [companionSlots](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdDisplayContainer#/c:objc(cs)IMAAdDisplayContainer(py)companionSlots)


  ` List of companion ad slots. Can be nil or empty.

  #### Declaration

  Swift

      var companionSlots: [https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMACompanionAdSlot.html]? { get }

  Objective-C

      @property (nonatomic, readonly, nullable) NSArray<https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMACompanionAdSlot.html *> *companionSlots;

- `


  ### [-initWithAdContainer:viewController:](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdDisplayContainer#/c:objc(cs)IMAAdDisplayContainer(im)initWithAdContainer:viewController:)


  ` Initializes IMAAdDisplayContainer for rendering the ad and displaying the ad UI without any
  companion slots.

  #### Declaration

  Swift

      init(adContainer: UIView, viewController adContainerViewController: UIViewController?)

  Objective-C

      - (nonnull instancetype)initWithAdContainer:(nonnull UIView *)adContainer
                                   viewController:(nullable UIViewController *)
                                                      https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdDisplayContainer.html#/c:objc(cs)IMAAdDisplayContainer(py)adContainerViewController;

  #### Parameters

  |---|---|
  | ` adContainer ` | The view where the ad will be rendered. Fills the view's bounds. |
  | ` adContainerViewController ` | The view controller containing the ad container. If not provided here, must be set on the property before making an ads or stream request. |

  #### Return Value

  A new IMAAdDisplayContainer instance
- `


  ### [-initWithAdContainer:viewController:companionSlots:](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdDisplayContainer#/c:objc(cs)IMAAdDisplayContainer(im)initWithAdContainer:viewController:companionSlots:)


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

  #### Declaration

  Swift

      init(adContainer: UIView, viewController adContainerViewController: UIViewController?, companionSlots: [https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMACompanionAdSlot.html]?)

  Objective-C

      - (nonnull instancetype)
          initWithAdContainer:(nonnull UIView *)adContainer
               viewController:(nullable UIViewController *)adContainerViewController
               companionSlots:
                   (nullable NSArray<https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMACompanionAdSlot.html *> *)companionSlots;

  #### Parameters

  |---|---|
  | ` adContainer ` | The view where the ad will be rendered. Fills the view's bounds. |
  | ` adContainerViewController ` | The view controller containing the ad container. If not provided here, must be set on the property before making an ads or stream request. |
  | ` companionSlots ` | The array of IMACompanionAdSlots. Can be nil or empty. |

  #### Return Value

  A new IMAAdDisplayContainer instance
- `


  ### [-registerFriendlyObstruction:](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdDisplayContainer#/c:objc(cs)IMAAdDisplayContainer(im)registerFriendlyObstruction:)


  ` Registers a view that overlays or obstructs this container as "friendly" for viewability
  measurement purposes.

  See [Open Measurement
  in the IMA SDK](https://developers.google.com/interactive-media-ads/docs/sdks/ios/omsdk) for guidance on what is and what is not allowed to be registered.

  #### Declaration

  Swift

      func register(_ friendlyObstruction: https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAFriendlyObstruction.html)

  Objective-C

      - (void)registerFriendlyObstruction:
          (nonnull https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAFriendlyObstruction.html *)friendlyObstruction;

  #### Parameters

  |---|---|
  | ` friendlyObstruction ` | An obstruction to be marked as "friendly" until unregistered. |

- `


  ### [-unregisterAllFriendlyObstructions](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdDisplayContainer#/c:objc(cs)IMAAdDisplayContainer(im)unregisterAllFriendlyObstructions)


  ` Unregisters all previously registered friendly obstructions.

  #### Declaration

  Swift

      func unregisterAllFriendlyObstructions()

  Objective-C

      - (void)unregisterAllFriendlyObstructions;