如何让我的 iAd 横幅出现在屏幕底部?
我有以下代码,允许我将其放置在顶部。我希望它出现在底部。
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0, -50);
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:adView];
任何帮助将不胜感激。
I have the following code that allows me to position it on the top. I am wanting it to appear at the bottom.
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0, -50);
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:adView];
Any assistance will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
更新 — @larsacus 指出这是针对 4.2+ 的:
Update—@larsacus pointed out this is for 4.2+:
我的第一个答案:)
为什么不使用 adView 的“center”属性?如果主视图的尺寸是 viewWidth 和 viewHeight:
干杯
My first answer on SO :)
Why not use the 'center' property of the adView? If the dimensions of your main view are viewWidth and viewHeight:
Cheers
这帮助我将视图移动到底部:
adFrame.origin.y = self.view.frame.size.height;
adView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
This is what helped me move the view to the bottom:
adFrame.origin.y = self.view.frame.size.height;
adView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
然后,使用故事板时,请忽略标准 iAd 横幅视图未到达屏幕边缘的情况。
将 iAd 横幅设置为居中,然后将其移动到您想要的尽可能靠近底部的位置。没有其他宽度设置(没有前导或尾随设置),
我的看起来不错,距超级视图底部 8 像素,但我选择了 - iAd 横幅和 UIController 视图之间的像素。
Using Storyboards, then, ignore that the standard iAd Banner View does not reach the edges of the screen.
Set the iAd banner to be centred, then move it to as close to the bottom as you want. No other width settings (no leading or trailing settings)
Mine looked ok with 8 pixels from the bottom of the superview, but I went with - pixels between the iAd banner and the UIController View.