GoogleMobileAds Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GAMBannerView
The view that displays Ad Manager banner ads.
To request this ad type using GADAdLoader, you need to pass GADAdLoaderAdTypeGAMBanner (see
GADAdLoaderAdTypes.h) to the |adTypes| parameter in GADAdLoader’s initializer method. If you
request this ad type, your delegate must conform to the GAMBannerAdLoaderDelegate protocol.
-
Required value created on the Ad Manager website. Create a new ad unit for every unique
placement of an ad in your application. Set this to the ID assigned for this placement. Ad units
are important for targeting and statistics.
Example Ad Manager ad unit ID: @“/6499/example/banner”
Declaration
Swift
var adUnitID: String? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSString *adUnitID;
-
Optional delegate that is notified when creatives send app events.
Declaration
Swift
@IBOutlet weak var appEventDelegate: (any AppEventDelegate)? { get set }
-
Optional delegate that is notified when creatives cause the banner to change size.
Declaration
Swift
@IBOutlet weak var adSizeDelegate: (any AdSizeDelegate)? { get set }
Objective-C
@property (nonatomic, weak, nullable) id<GADAdSizeDelegate> adSizeDelegate;
-
Optional array of NSValue encoded GADAdSize structs, specifying all valid sizes that are
appropriate for this slot. Never create your own GADAdSize directly. Use one of the predefined
standard ad sizes (such as GADAdSizeBanner), or create one using the GADAdSizeFromCGSize
method.
Example:
\code
NSArray *validSizes = @[
NSValueFromGADAdSize(GADAdSizeBanner),
NSValueFromGADAdSize(GADAdSizeLargeBanner)
];
bannerView.validAdSizes = validSizes;
\endcode
Declaration
Swift
var validAdSizes: [NSValue]? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSArray<NSValue *> *validAdSizes;
-
Indicates that the publisher will record impressions manually when the ad becomes visible to the
user.
Declaration
Swift
var enableManualImpressions: Bool { get set }
Objective-C
@property (nonatomic) BOOL enableManualImpressions;
-
Video controller for controlling video rendered by this ad view.
Declaration
Swift
var videoController: VideoController { get }
-
If you’ve set manualImpressionsEnabled to YES, call this method when the ad is visible.
Declaration
Swift
func recordImpression()
Objective-C
- (void)recordImpression;
-
Use this function to resize the banner view without launching a new ad request.
Declaration
Swift
func resize(_ size: AdSize)
-
Sets options that configure ad loading.
Parameters
adOptions
|
An array of GADAdLoaderOptions objects. The array is deep copied and option
objects cannot be modified after calling this method.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[null,null,["Last updated 2025-08-20 UTC."],[[["\u003cp\u003eGAMBannerView is a view that displays Ad Manager banner ads, and requests can be made using GADAdLoader with the GADAdLoaderAdTypeGAMBanner ad type.\u003c/p\u003e\n"],["\u003cp\u003eIt requires an adUnitID, created on the Ad Manager website, to identify the ad placement within the application.\u003c/p\u003e\n"],["\u003cp\u003eThis view offers optional delegates for handling app events and ad size changes, along with customizable ad sizes.\u003c/p\u003e\n"],["\u003cp\u003ePublishers can manually record impressions and resize the banner view without initiating a new ad request.\u003c/p\u003e\n"],["\u003cp\u003eAd loading behavior can be further configured using ad options provided through the \u003ccode\u003esetAdOptions:\u003c/code\u003e method.\u003c/p\u003e\n"]]],[],null,["# GoogleMobileAds Framework Reference\n\nGAMBannerView\n=============\n\n\n @interface GAMBannerView : ../Classes/GADBannerView.html\n\nThe view that displays Ad Manager banner ads.\n\nTo request this ad type using GADAdLoader, you need to pass GADAdLoaderAdTypeGAMBanner (see\nGADAdLoaderAdTypes.h) to the \\|adTypes\\| parameter in GADAdLoader's initializer method. If you\nrequest this ad type, your delegate must conform to the GAMBannerAdLoaderDelegate protocol.\n- `\n ``\n ``\n `\n\n ### [adUnitID](#/c:objc(cs)GAMBannerView(py)adUnitID)\n\n `\n ` \n Required value created on the Ad Manager website. Create a new ad unit for every unique\n placement of an ad in your application. Set this to the ID assigned for this placement. Ad units\n are important for targeting and statistics.\n\n Example Ad Manager ad unit ID: @\"/6499/example/banner\" \n\n #### Declaration\n\n Swift \n\n var adUnitID: String? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSString *adUnitID;\n\n- `\n ``\n ``\n `\n\n ### [appEventDelegate](#/c:objc(cs)GAMBannerView(py)appEventDelegate)\n\n `\n ` \n Optional delegate that is notified when creatives send app events. \n\n #### Declaration\n\n Swift \n\n @IBOutlet weak var appEventDelegate: (any AppEventDelegate)? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) id\u003c../Protocols/GADAppEventDelegate.html\u003e appEventDelegate;\n\n- `\n ``\n ``\n `\n\n ### [adSizeDelegate](#/c:objc(cs)GAMBannerView(py)adSizeDelegate)\n\n `\n ` \n Optional delegate that is notified when creatives cause the banner to change size. \n\n #### Declaration\n\n Swift \n\n @IBOutlet weak var adSizeDelegate: (any AdSizeDelegate)? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) id\u003c../Protocols/GADAdSizeDelegate.html\u003e adSizeDelegate;\n\n- `\n ``\n ``\n `\n\n ### [validAdSizes](#/c:objc(cs)GAMBannerView(py)validAdSizes)\n\n `\n ` \n Optional array of NSValue encoded GADAdSize structs, specifying all valid sizes that are\n appropriate for this slot. Never create your own GADAdSize directly. Use one of the predefined\n standard ad sizes (such as GADAdSizeBanner), or create one using the GADAdSizeFromCGSize\n method.\n\n Example:\n\n \\\\code\n NSArray \\*validSizes = @\\[\n NSValueFromGADAdSize(GADAdSizeBanner),\n NSValueFromGADAdSize(GADAdSizeLargeBanner)\n \\];\n\n bannerView.validAdSizes = validSizes;\n \\\\endcode \n\n #### Declaration\n\n Swift \n\n var validAdSizes: [NSValue]? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSArray\u003cNSValue *\u003e *validAdSizes;\n\n- `\n ``\n ``\n `\n\n ### [enableManualImpressions](#/c:objc(cs)GAMBannerView(py)enableManualImpressions)\n\n `\n ` \n Indicates that the publisher will record impressions manually when the ad becomes visible to the\n user. \n\n #### Declaration\n\n Swift \n\n var enableManualImpressions: Bool { get set }\n\n Objective-C \n\n @property (nonatomic) BOOL enableManualImpressions;\n\n- `\n ``\n ``\n `\n\n ### [videoController](#/c:objc(cs)GAMBannerView(py)videoController)\n\n `\n ` \n Video controller for controlling video rendered by this ad view. \n\n #### Declaration\n\n Swift \n\n var videoController: VideoController { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nonnull) ../Classes/GADVideoController.html *videoController;\n\n- `\n ``\n ``\n `\n\n ### [-recordImpression](#/c:objc(cs)GAMBannerView(im)recordImpression)\n\n `\n ` \n If you've set manualImpressionsEnabled to YES, call this method when the ad is visible. \n\n #### Declaration\n\n Swift \n\n func recordImpression()\n\n Objective-C \n\n - (void)recordImpression;\n\n- `\n ``\n ``\n `\n\n ### [-resize:](#/c:objc(cs)GAMBannerView(im)resize:)\n\n `\n ` \n Use this function to resize the banner view without launching a new ad request. \n\n #### Declaration\n\n Swift \n\n func resize(_ size: AdSize)\n\n Objective-C \n\n - (void)resize:(../Structs/GADAdSize.html)size;\n\n- `\n ``\n ``\n `\n\n ### [-setAdOptions:](#/c:objc(cs)GAMBannerView(im)setAdOptions:)\n\n `\n ` \n Sets options that configure ad loading. \n\n #### Declaration\n\n Swift \n\n func setAdOptions(_ adOptions: [../Classes.html#/c:objc(cs)GADAdLoaderOptions])\n\n Objective-C \n\n - (void)setAdOptions:(nonnull NSArray\u003c../Classes.html#/c:objc(cs)GADAdLoaderOptions *\u003e *)adOptions;\n\n #### Parameters\n\n |-------------------|-----------------------------------------------------------------------------------------------------------------------------------|\n | ` `*adOptions*` ` | An array of GADAdLoaderOptions objects. The array is deep copied and option objects cannot be modified after calling this method. |"]]