简体   繁体   English

风景iAd在iOS6中显示人像图形吗?

[英]Landscape iAd is showing the portrait graphic in iOS6?

My app runs in the Portrait orientation, but the content inside rotates with the accelerometer. 我的应用程序以纵向方向运行,但是其中的内容随加速度计旋转。 I show an iAd on the bottom of the screen. 我在屏幕底部显示一个iAd。 The iAd changed position as you rotate, but the actual interface does not rotate (shouldAutorotate returns NO, all the rotates are handled in OpenGL). iAd会随着旋转而改变位置,但实际界面不会旋转(shouldAutorotate返回NO,所有旋转都在OpenGL中进行处理)。 So the iAd is positioned, and then a transform is set to rotate it so it's the correct way up for the user. 因此,先定位iAd,然后将其设置为旋转将其旋转,这样对用户来说是正确的方式。 When the app is in Portrait, it's the portrait ad. 当应用程序处于纵向模式时,它就是纵向广告。 When in Landscape, it's the landscape. 在风景中时,就是风景。 This has been working perfectly since iAds were first released... til now. 自iAds首次发布以来,效果一直很好……直到现在。

In iOS6, the iAd is still positioned correctly, but no matter what I do, the content is not. 在iOS6中,iAd仍然可以正确定位,但是无论我做什么,内容都不会正确。 It seems like iOS6 decides which type of ad it should show. 似乎iOS6 决定了应显示哪种广告。 I think this is to do with the autosizing. 我认为这与自动调整大小有关。 But I'm confused about how to stop it. 但是我对如何阻止它感到困惑。 I end up with the portrait graphic being shown in landscape mode... over to one side... and cut off because of the thinner ad space. 最后,我将人像图形以横向模式显示在一侧...由于广告空间变薄而被切除。

Has anyone else seen this behaviour? 还有其他人看到过这种行为吗? It's only under iOS6. 仅在iOS6下。 Does anyone know how to stop the iAd from auto-sizing/content rotating? 有人知道如何阻止iAd自动调整大小/内容旋转吗?

Any help would be greatly appreciated. 任何帮助将不胜感激。

This may be due to autolayout, a new feature of iOS 6. Check the first ("File Inspector") tab of your storyboard and if "Use Autolayout" is ticked, that's probably your issue! 这可能是由于iOS 6的新功能自动布局造成的。请检查情节提要的第一个(“文件检查器”)选项卡,如果勾选了“使用自动布局”,则可能是您的问题!

With autolayout enabled, views are based on 'constraints' instead of the simple autosizing parameters previously available. 启用自动布局后,视图基于“约束”,而不是先前可用的简单自动调整参数。 These contraints override most attempted changes to the frame of subviews - and that would therefore explain your problem. 这些限制会覆盖对子视图框架进行的大多数尝试更改,因此可以解释您的问题。

It's possible to continue using autolayout and ensure that your constraints are set correctly, but if you're relying on code to change the position/size of your ad view then I would recommend simply disabling autolayout, which should make your resizing normal again! 可以继续使用自动版式并确保正确设置了约束,但是如果您依靠代码来更改广告视图的位置/大小,那么我建议您简单地禁用自动版式,这样可以使调整大小后再次正常!

I imagine you are using a similar method to below for when a banner is loaded? 我想您正在使用以下类似的方法来加载横幅广告?

 - (void)bannerViewDidLoadAd:(ADBannerView *)banner {

       self.bannerView.frame = CGRectZero;
 }

Try changing it to something like this 尝试将其更改为这样的内容

 - (void)bannerViewDidLoadAd:(ADBannerView *)banner {

       self.bannerView.frame = CGRectMake(0, 0, 480, 32);
 }

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

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