智能横幅广告
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
作为一种广告单元,智能横幅可在任何屏幕尺寸、任何屏幕方向的各种设备上展示与屏幕等宽的横幅广告。智能横幅可以检测设备处于当前屏幕方向时的宽度,并据此创建与之等宽的广告视图。
在 iPhone 上,当屏幕为纵向时,智能横幅广告高度为 50 点;当屏幕为横向时,广告高度为 32 点。在 iPad 上,智能横幅广告高度在屏幕为纵向和横向时均为 90 点。
当图片广告不足以占据所分配的整个空间时,系统会居中放置图片,然后填充两侧剩余的空间。

要使用智能横幅广告,只需为广告尺寸指定 kGADAdSizeSmartBannerPortrait
(适用于纵向屏幕)或 kGADAdSizeSmartBannerLandscape
(适用于横向屏幕)即可:
Swift
let bannerView = GAMBannerView(adSize: kGADAdSizeSmartBannerPortrait)
Objective-C
GAMBannerView *bannerView = [[GAMBannerView alloc]
initWithAdSize:kGADAdSizeSmartBannerPortrait];
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-25。
[null,null,["最后更新时间 (UTC):2025-08-25。"],[[["\u003cp\u003eSmart Banners automatically adjust to screen width on different devices and orientations, with fixed heights of 50/32 points on iPhones (portrait/landscape) and 90 points on iPads.\u003c/p\u003e\n"],["\u003cp\u003eThey display screen-width banner ads, centering smaller image ads and filling the surrounding space.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can implement Smart Banners using \u003ccode\u003ekGADAdSizeSmartBannerPortrait\u003c/code\u003e for portrait or \u003ccode\u003ekGADAdSizeSmartBannerLandscape\u003c/code\u003e for landscape orientation.\u003c/p\u003e\n"],["\u003cp\u003eIt is recommended to use adaptive banners instead of Smart Banners for better functionality.\u003c/p\u003e\n"]]],["Smart Banners display screen-width ads, adapting to any device size and orientation. They automatically detect device width and create appropriately sized ad views. On iPhones, banner heights are 50 points in portrait and 32 in landscape; on iPads, they are 90 points in both. Smaller image ads are centered, with surrounding space filled in. To implement, set the ad size to `kGADAdSizeSmartBannerPortrait` or `kGADAdSizeSmartBannerLandscape`. The newer adaptive banners are an alternative.\n"],null,["| Try the newer [adaptive banners](/ad-manager/mobile-ads-sdk/ios/banner/anchored-adaptive) instead.\n\nSmart Banners are ad units that render screen-width banner ads on any screen\nsize across different devices in either orientation. Smart Banners detect the\nwidth of the device in its current orientation and create the ad view that size.\n\nSmart Banners on iPhones have a height of 50 points in portrait and 32 points in\nlandscape. On iPads, height is 90 points in both portrait and landscape.\n\nWhen an image ad isn't large enough to take up the entire allotted space, the\nimage will be centered, and the space on either side will be filled in.\n\nTo use Smart Banners, just specify `kGADAdSizeSmartBannerPortrait`\n(for portait orientation) or `kGADAdSizeSmartBannerLandscape` (for landscape\norientation) for the ad size: \n\nSwift \n\n```swift\nlet bannerView = GAMBannerView(adSize: kGADAdSizeSmartBannerPortrait)\n```\n\nObjective-C \n\n```objective-c\nGAMBannerView *bannerView = [[GAMBannerView alloc]\n initWithAdSize:kGADAdSizeSmartBannerPortrait];\n```"]]