问题描述
这看起来应该很简单,但是文档尚不清楚.在简介中在ADBannerView
类中,Apple这样说:
This seems like it should be simple, but the documentation is very unclear. In the introduction of the ADBannerView
class, Apple says this:
但是,从iOS 6开始,这些方法在文档中都标记为已弃用:
However, these methods are all marked in the documentation as deprecated since iOS 6:
如果您访问内容大小标识符" ,除了这些常量的文档(自iOS 6起全部标记为已废弃),什么都找不到.
If you go to "Content Size Identifiers", nothing can be found except the documentation for these constants, all marked as depricated since iOS 6. The rest of the documentation doesn't seem to be any help either.
如果不赞成使用这些方法,并且似乎什么都没有取代,那么如何调整iAd标语的大小并获得其尺寸?
If these methods are deprecated, and nothing seems to have taken their place, how are you supposed to resize and get the size of iAd banners?
推荐答案
无需设置ADBannerView
的大小.您的ADBannerView
将知道它在哪个设备上并正确设置其尺寸.您需要做的只是设置ADBannerView
的位置.查看此实现作为示例.
There's no need to set the ADBannerView
's size. Your ADBannerView
will know which device it is on and set the dimensions of itself correctly. All you need to do is set the ADBannerView
's position. Check this implementation for an example.
如果您使用的是自动版式,并且希望ADBannerView
位于屏幕底部,请使用Bottom Space to: Bottom Layout Guide
将其固定在屏幕底部,并将其与Align Center X to: Superview
对齐.确保您不要设置任何高度,宽度,尾随或前导约束
If you're using Auto Layout and wanted the ADBannerView
to be at the bottom of the screen then pin it to the bottom of the screen with Bottom Space to: Bottom Layout Guide
and align it to Align Center X to: Superview
. Be sure you do not set any height, width, trailing, or leading constraints
这篇关于调整iAd横幅视图的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!