简体   繁体   English

iAd以景观为视角

[英]iAd on top of view in landscape

Right now I have an iAd banner on the bottom of my view when the device is in landscape. 现在,当设备处于横向时,我的视图底部有一个iAd横幅。 How do I get the iAd banner to be on top of the view when the device is in landscape? 当设备处于横向时,如何使iAd标语位于视图顶部?

banner.frame = CGRectOffset(banner.frame, -banner.frame.size.width/50, -banner.frame.size.height);
 Banner.frame = CGRectMake(0,0,480,32);

是解决方案

You should not be setting static points for your ADBannerView . 您不应为ADBannerView设置静态点。 What happens when you run your application on a device that has different screen dimensions? 在屏幕尺寸不同的设备上运行应用程序时会发生什么?

What you should be doing is setting your ADBannerView 's frame relative to the UIView it is displayed within, like so: 您应该做的是相对于其中显示的UIView设置ADBannerViewframe ,如下所示:

iAdBannerView.frame = CGRectMake(0, 0, self.view.frame.size.width, iAdBannerView.frame.size.height);

Read the answers to this question, UIView frame, bounds and center , for a better understanding of what frame refers to exactly. 阅读该问题的答案,即UIView框架,边界和居中 ,以更好地了解frame确切地指的是什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM