<br />

Google Mobile Ads SDK supports fixed ad sizes for situations where adaptive
banners ads don't meet your needs.

The following table lists the standard banner sizes.

| Size in dp (WxH) | Description | Availability | AdSize constant |
|---|---|---|---|
| 320x50 | Banner | Phones and tablets | `GADAdSizeBanner` |
| 320x100 | Large banner | Phones and tablets | `GADAdSizeLargeBanner` |
| 300x250 | IAB medium rectangle | Phones and tablets | `GADAdSizeMediumRectangle` |
| 468x60 | IAB full-size banner | Tablets | `GADAdSizeFullBanner` |
| 728x90 | IAB leaderboard | Tablets | `GADAdSizeLeaderboard` |

To define a custom banner size, set your size using [`GADAdSizeFromCGSize`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions.md.txt):

### Swift

```swift
let adSize = adSizeFor(cgSize: CGSize(width: 250, height: 250))
```

### Objective-C

```objective-c
GADAdSize size = GADAdSizeFromCGSize(CGSizeMake(250, 250));
```

Set an ad size smaller than or equal to the device screen size.
To determine the maximum screen size on iOS 26 and later, use the
[`UIWindowScene.effectiveGeometry.coordinateSpace`](https://developer.apple.com/documentation/uikit/uiwindowscene/geometry/coordinatespace)
property. On iOS 18 and earlier, use the
[`UIWindowScene.coordinateSpace`](https://developer.apple.com/documentation/uikit/uiwindowscene/coordinatespace)
property.
For details about size constraints, see
[Troubleshoot unfilled impressions in Ad Manager](https://support.google.com/admanager/answer/1739296).


## Fixed size banner ads example

[Swift](https://github.com/googleads/googleads-mobile-ios-examples/blob/main/Swift/advanced/APIDemo/APIDemo/AdMobBannerSizesViewController.swift)
[Objective-C](https://github.com/googleads/googleads-mobile-ios-examples/blob/main/Objective-C/advanced/APIDemo/APIDemo/AdMobBannerSizesViewController.m)

## Custom ad size

In addition to the standard ad units, Google Ad Manager lets you serve any sized
ad unit into an app. The ad size (width, height) defined for an ad request
should match the dimensions of the ad view (`GAMBannerView`) displayed on the
app. To set a custom size, use [`GADAdSizeFromCGSize`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions.md.txt#/c:@F@CGSizeFromGADAdSize).

### Swift

```swift
// Define custom GADAdSize of 250x250 for GAMBannerView.
let customAdSize = adSizeFor(cgSize: CGSize(width: 250, height: 250))
bannerView = GAMBannerView(adSize: customAdSize)
```

### Objective-C

```objective-c
// Define custom GADAdSize of 250x250 for GAMBannerView
GADAdSize customAdSize = GADAdSizeFromCGSize(CGSizeMake(250, 250));
self.bannerView = [[GAMBannerView alloc] initWithAdSize:customAdSize];
```

## Multiple ad sizes

Ad Manager lets you specify multiple ad sizes which could be eligible to serve
into a `GAMBannerView`. There are three steps needed in order to use this
feature:

1. In the Ad Manager UI, create a line item targeting the same ad unit that is
   associated with different size creatives.

2. In your app, set the `validAdSizes` property on `GAMBannerView`:

   ### Swift

   ```swift
   // Define an optional array of GADAdSize to specify 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.
   //
   // Note: Ensure that the allocated GAMBannerView is defined with an ad size. Also note
   // that all desired sizes should be included in the validAdSizes array.
   bannerView.validAdSizes = [NSValueFromGADAdSize(AdSizeBanner),
       NSValueFromGADAdSize(AdSizeMediumRectangle),
       NSValueFromGADAdSize(adSizeFor(cgSize: CGSize(width: 120, height: 20)))]
   ```

   ### Objective-C

   ```objective-c
   // Define an optional array of GADAdSize to specify 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.
   //
   // Note: Ensure that the allocated GAMBannerView is defined with an ad size. Also note
   // that all desired sizes should be included in the validAdSizes array.
   self.bannerView.validAdSizes = @[
       NSValueFromGADAdSize(GADAdSizeBanner),
       NSValueFromGADAdSize(GADAdSizeMediumRectangle),
       NSValueFromGADAdSize(GADAdSizeFromCGSize(CGSizeMake(120, 20)))
   ];
   ```
3. Implement the `GADAdSizeDelegate` method to detect an ad size change.

   ### Swift

   ```swift
   public func bannerView(_ bannerView: BannerView, willChangeAdSizeTo size: AdSize)
   ```

   ### Objective-C

   ```objective-c
   - (void)bannerView:(GAMBannerView *)view willChangeAdSizeTo:(GADAdSize)size;
   ```

   Remember to set the delegate before making the request for an ad.

   ### Swift

   ```swift
   bannerView.adSizeDelegate = self
   ```

   ### Objective-C

   ```objective-c
   self.bannerView.adSizeDelegate = self;
   ```

## Multiple ad sizes example

[Swift](https://github.com/googleads/googleads-mobile-ios-examples/blob/main/Swift/advanced/APIDemo/APIDemo/AdManagerMultipleAdSizesViewController.swift)
[Objective-C](https://github.com/googleads/googleads-mobile-ios-examples/blob/main/Objective-C/advanced/APIDemo/APIDemo/GAMMultipleAdSizesViewController.m)