AdWhirl 轮换使用
我正在尝试旋转 AdWhirl 横幅视图。 AdWhirl 提供的唯一文档是:
6.2 设备方向 包括 iAd 在内的一些广告网络会根据设备方向改变其广告尺寸。 如果您的应用支持旋转,您必须通过在 UIViewController 的 should/willAutorotateToInterfaceOrientation: 实现中调用 AdWhirlView.rotateToOrientation: 将方向更改转发到 AdWhirlView,然后按照 6.1 进行重新调整。 如果您的应用的方向概念与 UIDevice.orientation 有所不同,您还必须实现 AdWhirlDelegate.adWhirlCurrentOrientation 以返回适当的值。
我正在尝试解决这个问题,到目前为止已正确实现了 adWhirlDidReceiveAd 方法,但我无法正确旋转和/或调整相关广告的大小。
Im trying to rotate the AdWhirl bannerview. The only documentation AdWhirl provides is:
6.2 Device Orientation
Some ad networks including iAd will vary their ad dimensions with device orientation.
If your app supports rotation you must forward orientation changes to AdWhirlView by invoking AdWhirlView.rotateToOrientation: within your UIViewController’s should/willAutorotateToInterfaceOrientation: implementation and then refit as per 6.1.
If your app’s notion of orientation somehow differs from UIDevice.orientation you must also implement AdWhirlDelegate.adWhirlCurrentOrientation to return the appropriate value.
I'm trying to figure this out and so far correctly implemented the adWhirlDidReceiveAd method but I can't correctly rotate and/or resize the ad in question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将 AdWhirl 设置在视图底部:此处
使广告在滚动时静态(即TableView):这里
这就是我使用 AdWhirl 旋转广告的方式(可能不是最好的解决方案...):
您需要根据您的视图更改坐标。
Set AdWhirl at the bottom of the view: here
Make the ad static when scrolling (i.e. TableView): here
This is how I rotate ads with AdWhirl (probably not the best solution...):
You'll need to change the coordinates depending on your view.
[AdWhirlViewrotateToOrientation] 为每个当前网络适配器调用
rotateToOrientation
方法。但是,某些网络适配器不会覆盖此方法。此方法的默认实现不执行任何操作。
因此,您需要重写rotateToOrientation方法。
接下来是 AdMob 网络适配器的示例实现。
AdWhirlAdapterGoogleAdMobAds.m
[AdWhirlView rotateToOrientation] calls
rotateToOrientation
method for each current network adapter.However, some network adapter does't override this method. Default implementation of this method does nothing.
So, you need to override rotateToOrientation method.
Next is a sample implementation for network adapter for AdMob.
AdWhirlAdapterGoogleAdMobAds.m
在 UIViewController 实现中,添加 shouldAutorotateToInterfaceOrientation: ,如下所示:
请注意,只要实现了 shouldAutorotateToInterfaceOrientation: ,AdWhirlView 将随布局的其余部分一起旋转。但是,调用rotateToOrientation:将告诉AdWhirlView将方向变化信号转发到广告,以便单个广告网络可以根据需要优化广告的横向效果。
In your UIViewController implementation, add the shouldAutorotateToInterfaceOrientation: like so:
Note that as long as shouldAutorotateToInterfaceOrientation: is implemented, the AdWhirlView will rotate with the rest of the layout. However, calling rotateToOrientation: will tell the AdWhirlView to forward an orientation change signal to the ad so that an individual ad network can optimize the ad for landscape if it chooses.