Programmatically hiding Apple iAd ADBannerView

非 Y 不嫁゛ 提交于 2019-12-11 07:25:07

问题


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.

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.

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

What's the best way to programatically hide ADBannerView?


回答1:


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:

  • 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.


来源:https://stackoverflow.com/questions/11197601/programmatically-hiding-apple-iad-adbannerview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!