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.
[[["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-08-20 UTC."],[[["\u003cp\u003e\u003ccode\u003eGAMBannerView\u003c/code\u003e is a view used to display Ad Manager banner ads within an application.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize the ad unit ID, manage ad sizes, and control impressions for your banner ads.\u003c/p\u003e\n"],["\u003cp\u003eThis view allows for manual impression recording and ad resizing without initiating a new ad request.\u003c/p\u003e\n"],["\u003cp\u003eDelegates can be set to handle app events and ad size changes triggered by creatives.\u003c/p\u003e\n"],["\u003cp\u003eVideo content within the banner ad can be controlled using the integrated \u003ccode\u003evideoController\u003c/code\u003e.\u003c/p\u003e\n"]]],["`GAMBannerView` displays Ad Manager banner ads. Key actions include setting the `adUnitID` for ad placement, optionally assigning `appEventDelegate` and `adSizeDelegate`, and specifying `validAdSizes`. Publishers can enable `manualImpressions` and call `recordImpression` when the ad is visible. `videoController` manages video ads. The view can be resized with `resize`, and `setAdOptions` configures ad loading using an array of `GADAdLoaderOptions`.\n"],null,["GAMBannerView \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 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 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 Optional delegate that is notified when creatives send app events. \n\n Declaration \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 Optional delegate that is notified when creatives cause the banner to change size. \n\n Declaration \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 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 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 Indicates that the publisher will record impressions manually when the ad becomes visible to the\n user. \n\n Declaration \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 Video controller for controlling video rendered by this ad view. \n\n Declaration \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 If you've set manualImpressionsEnabled to YES, call this method when the ad is visible. \n\n Declaration \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 Use this function to resize the banner view without launching a new ad request. \n\n Declaration \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 Sets options that configure ad loading. \n\n Declaration \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. |"]]