<br />

Adaptive banners let you specify the width of an ad to determine the optimal
ad size for each device. Unlike anchored adaptive banners, inline adaptive
banners are larger, taller, and don't use fixed heights. Inline adaptive banners
have variable height. These banners might fill the entire screen or a maximum
height you specify.

This guide covers creating inline adaptive banners and setting the banner
size.

The following image shows inline adaptive banners in scrolling content:

![Diagram showing differences in adaptive and inline adaptive banners](https://developers.google.com/static/admob/images/inline-adaptive.png)

## Before you begin

Before continuing, make sure you [set up banner ads](https://developers.google.com/admob/ios/banner.md.txt).

To view a full inline adaptive banner example, download the following
sample app:

- [Swift](https://github.com/googleads/googleads-mobile-ios-examples/tree/main/Swift/advanced/InlineAdaptiveBannerExample)
- [Objective-C](https://github.com/googleads/googleads-mobile-ios-examples/tree/main/Objective-C/advanced/InlineAdaptiveBannerExample)

## Implement inline adaptive banners

To implement inline adaptive banners, you set the ad size, create an ad request,
and load the ad.

To size an inline adaptive banner, determine the ad width. Common approaches
include the following:

- Using the full-screen width.
- Using the width of the parent layout containing the ad.
- Adjusting the width to account for device safe areas.

When creating the ad size object, use this calculated width.

The following example creates an inline adaptive ad size using the device's safe
area width:

### Swift

```swift
// Make sure the ad fits inside the readable area.
let adWidth = view.bounds.inset(by: view.safeAreaInsets).width
bannerView.adSize = currentOrientationInlineAdaptiveBanner(width: adWidth)
```

### Objective-C

```objective-c
// Make sure the ad fits inside the readable area.
CGFloat adWidth = CGRectGetWidth(UIEdgeInsetsInsetRect(view.bounds, view.safeAreaInsets));
bannerView.adSize = GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(adWidth);
```

<br />

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
[Ad request size requirements](https://support.google.com/admob/answer/9905175#ad-request-size-requirement).


## Set the inline adaptive banner layout

To preload an inline adaptive banner ad for a specific layout, use the
following methods:

- [`GADPortraitInlineAdaptiveBannerAdSizeWithWidth(CGFloat width)`](https://developers.google.com/admob/ios/api/reference/Functions.md.txt#gadportraitinlineadaptivebanneradsizewithwidth)

- [`GADLandscapeInlineAdaptiveBannerAdSizeWithWidth(CGFloat width)`](https://developers.google.com/admob/ios/api/reference/Functions.md.txt#gadlandscapeinlineadaptivebanneradsizewithwidth)

If your app supports portrait and landscape views, and you want to preload
an adaptive banner ad in the current layout, use the

[`GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(CGFloat width)`](https://developers.google.com/admob/ios/api/reference/Functions.md.txt#gadcurrentorientationinlineadaptivebanneradsizewithwidth)
method.
This method loads an ad in the current layout.

### Limit inline adaptive banner height

By default, inline adaptive banners created without a `maxHeight` value
have a maximum height equal to the device height. To limit the inline adaptive
banner height, use the

[`GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(CGFloat width, CGFloat maxHeight)`](https://developers.google.com/admob/ios/api/reference/Functions.md.txt#gadinlineadaptivebanneradsizewithwidthandmaxheight)

method.