> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kontext.so/llms.txt
> Use this file to discover all available pages before exploring further.

# 让广告避开你的控件

> 叠加广告条位于播放器视图的底部或顶部，暂停广告卡片位于顶部；SDK 把两者都保持在视图的安全区域内。

叠加广告条位于播放器视图的底部或顶部，暂停广告卡片位于顶部；SDK 把两者都保持在视图的安全区域内。如果你的播放器在那里绘制了自己的控件（标题、进度条、按钮），把它们占用的空间作为 `insets` 传入：

```swift theme={null}
// 你的控制栏高 80 点，位于播放器底部。
try? overlayAd?.show(in: playerView, insets: UIEdgeInsets(top: 0, left: 0, bottom: 80, right: 0))
```

* insets 叠加在安全区域之上，与 UIKit 的 `additionalSafeAreaInsets` 一样：从安全区域的边缘量起，而不是从屏幕边缘。
* 广告展示期间它们保持不变，经过改变大小和旋转也是如此。如果广告在屏幕上时你的控件改变了大小，广告保留展示时的 insets。
* 广告仍需至少能以一半大小放下。insets 会占用空间，因此 `containerTooSmall(minimum:)` 把它们计算在内。
* 全屏暂停广告忽略它们：它填满整个视图，它自己的控件会避开边缘。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.