Stay organized with collections
Save and categorize content based on your preferences.
IMACompanionAdSlot
@interfaceIMACompanionAdSlot:NSObject
Ad slot for companion ads. The SDK will put a subview inside the provided
UIView container. The companion will be matched to the width and height
provided here. This class cannot be instantiated on tvOS, where companion ads
are not available.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-14 UTC."],[[["\u003cp\u003e\u003ccode\u003eIMACompanionAdSlot\u003c/code\u003e manages companion ads, displayed in a provided UIView container.\u003c/p\u003e\n"],["\u003cp\u003eIt specifies the companion ad's dimensions (width and height) for targeting.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can receive companion ad events through the \u003ccode\u003eIMACompanionDelegate\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eInitialization can be done with fixed dimensions or fluid size using designated initializers.\u003c/p\u003e\n"],["\u003cp\u003eCompanion ads are not supported on tvOS.\u003c/p\u003e\n"]]],[],null,["# GoogleInteractiveMediaAds Framework Reference\n\nIMACompanionAdSlot\n==================\n\n @interface IMACompanionAdSlot : NSObject\n\nAd slot for companion ads. The SDK will put a subview inside the provided\nUIView container. The companion will be matched to the width and height\nprovided here. This class cannot be instantiated on tvOS, where companion ads\nare not available.\n- `\n ``\n ``\n `\n\n ### [view](#/c:objc(cs)IMACompanionAdSlot(py)view)\n\n `\n ` \n The view the companion will be rendered in. Display this view in your\n application before video ad starts. \n\n #### Declaration\n\n Swift \n\n var view: UIView { get }\n\n Objective-C \n\n @property (nonatomic, readonly) UIView *_Nonnull view;\n\n- `\n ``\n ``\n `\n\n ### [width](#/c:objc(cs)IMACompanionAdSlot(py)width)\n\n `\n ` \n Width of the slot, in pixels. This value is sent to the DFP ad server for\n targeting. \n\n #### Declaration\n\n Swift \n\n var width: Int { get }\n\n Objective-C \n\n @property (nonatomic, readonly) NSInteger width;\n\n- `\n ``\n ``\n `\n\n ### [height](#/c:objc(cs)IMACompanionAdSlot(py)height)\n\n `\n ` \n Height of the slot, in pixels. This value is sent to the DFP ad server for\n targeting. \n\n #### Declaration\n\n Swift \n\n var height: Int { get }\n\n Objective-C \n\n @property (nonatomic, readonly) NSInteger height;\n\n- `\n ``\n ``\n `\n\n ### [delegate](#/c:objc(cs)IMACompanionAdSlot(py)delegate)\n\n `\n ` \n The IMACompanionDelegate for receiving events from the companion ad slot. \n\n #### Declaration\n\n Swift \n\n weak var delegate: (any ../Protocols/IMACompanionDelegate.html)? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) id\u003c../Protocols/IMACompanionDelegate.html\u003e delegate;\n\n- `\n ``\n ``\n `\n\n ### [-initWithView:width:height:](#/c:objc(cs)IMACompanionAdSlot(im)initWithView:width:height:)\n\n `\n ` \n Initializes an instance of a IMACompanionAdSlot with design ad width and height. \n\n #### Declaration\n\n Swift \n\n init(view: UIView, width: Int, height: Int)\n\n Objective-C \n\n - (nonnull instancetype)initWithView:(nonnull UIView *)view\n width:(NSInteger)width\n height:(NSInteger)height;\n\n #### Parameters\n\n |----------------|-----------------------------------------------|\n | ` `*view*` ` | the UIView that will contain the companion ad |\n | ` `*width*` ` | the chosen width of the ad |\n | ` `*height*` ` | the chosen height of the ad |\n\n #### Return Value\n\n the IMACompanionAdSlot instance\n- `\n ``\n ``\n `\n\n ### [-initWithView:](#/c:objc(cs)IMACompanionAdSlot(im)initWithView:)\n\n `\n ` \n Initializes an instance of a IMACompanionAdSlot with fluid size. \n\n #### Declaration\n\n Swift \n\n init(view: UIView)\n\n Objective-C \n\n - (nonnull instancetype)initWithView:(nonnull UIView *)view;\n\n #### Parameters\n\n |--------------|------------------------------------------------|\n | ` `*view*` ` | the UIView that will contain the companion ad. |\n\n #### Return Value\n\n the IMACompanionAdSlot instance"]]