iAd +多个UITableViewControllers [英] iAd + multiple UITableViewControllers

查看:125
本文介绍了iAd +多个UITableViewControllers的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找这个问题..有没有办法将iAds(或AdMob,或任何其他移动广告的东西)添加到UITableViewControllers?最多,我的应用程序大约有3到4个级别,我希望不断在所有级别展示广告,而不是每次都发送新的广告请求(大多数解决方案都这样做)。

I've been looking for this for awhile now.. Is there a way to add iAds (or AdMob, or any other mobile advertising thing) to UITableViewControllers ? At the most, my app goes about 3 or 4 levels deep, and I'd like to keep showing ads throughout all levels, without sending new ad requests each time (most solutions do this).

提前致谢!

推荐答案

我知道这个问题很老,但对于其他任何好奇的人来说都是如此碰到了这个:你只需要在视图转换之间保留实例。我写了一个简单的单一类,它正是这样做的,因为我遇到了同样的问题。它在单个广告容器中管理iAd和AdMob广告,您可以在应用中移动,而无需担心创建和销毁广告的多个实例。当您从一个视图移动到另一个视图时,只需在 viewDidAppear 或类似的地方调用一行代码。它会自动从旧视图中删除广告容器,并将其添加到新视图中,在应用会话的整个生命周期内保留相同的广告。

I know this question is old, but for anyone else that is curious and ran into this: You simply need to retain the instances between view transitions. I've written a simple singleton class that does exactly this because I was running into the same issues. It manages both iAds and AdMob ads in a single ad container that you can shuttle around your app without having to worry about creating and destroying multiple instances of your ads. When you move from one view to another, simply call one line of code in viewDidAppear or somewhere similar. It will automatically remove the ad container from the old view and add it to the new view, retaining the same ad throughout the life of the app session.

在此方法之前,我每次去新视图时都只是创建新的广告实例(适用于iAd和AdMob)。绝对不理想。

Before this method, I was simply creating new ad instances (for both iAd and AdMob) every time I went to a new view. Definitely not ideal.

这篇关于iAd +多个UITableViewControllers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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