以编程方式隐藏Apple iAd ADBannerView [英] Programmatically hiding Apple iAd ADBannerView

查看:92
本文介绍了以编程方式隐藏Apple iAd ADBannerView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我偶尔会隐藏 ADBannerView 。我正在考虑 banner.hidden = YES ,类似于取消隐藏。我担心Apple会对此不满意,因为在横幅隐藏时接收和显示广告似乎是有问题的。

I'd like to occasionally hide an ADBannerView. I'm thinking about banner.hidden = YES and similar to un-hide. I'm concerned that Apple will frown upon this because receiving and "displaying" ads while the banner is hidden seems questionable.

bannerView:didFailToReceiveAdWithError:中,我将横幅广告从屏幕底部移动了出来。我愿意这样做,而不是使用隐藏属性,如果情况有所改善。

In bannerView:didFailToReceiveAdWithError: I'm animating the banner off the screen bottom. I'm open to doing this instead of using the hidden property if it's somehow better.

也许可以告诉横幅停止请求广告。不幸的是,在查看 ADBannerView.h 时,什么都没跳出来。

Perhaps it's possible to tell the banner to stop requesting ads. Unfortunately nothing jumped out at me while looking over ADBannerView.h.

编程的最佳方法是什么隐藏 ADBannerView

What's the best way to programatically hide ADBannerView?

推荐答案

iAd编程指南 [由我加粗强调]:

The way to tell a banner view to stop receiving ads is to destroy it when not needed, as stated in the iAd Programming Guide [with bold emphasis added by me]:


在设计应用程序时,请牢记以下原则:

When designing your application, keep the following principles in mind:


  • 仅当创建横幅视图时您打算将其显示给用户。否则,它可能会在广告中循环播放,并耗尽您的应用程序的可用广告列表。

  • 如果用户从带有横幅视图的内容屏幕导航到没有标题的屏幕横幅视图,并且您希望它们在该屏幕上显示很长一段时间,请从视图层次结构中删除横幅视图,将其委托设置为nil并释放,然后再切换到新的屏幕内容。更一般而言,避免在用户看不见横幅广告时保持周围。

  • Only create a banner view when you intend to display it to the user. Otherwise, it may cycle through ads and deplete the list of available advertising for your application.
  • If the user navigates from a screen of content with a banner view to a screen that does not have a banner view, and you expect them to be on that screen for a long period of time, remove the banner view from the view hierarchy, set its delegate to nil and release it before transitioning to the new screen of content. More generally, avoid keeping a banner view around when it is invisible to the user.

这篇关于以编程方式隐藏Apple iAd ADBannerView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆