UITableViewCell 中的 ADBannerView

发布于 2024-09-13 01:16:43 字数 795 浏览 4 评论 0原文

在表格视图单元格中放置广告的最佳做法是什么?这是我的代码,该代码一直有效,直到横幅收到 transitionToNextBanner 事件,然后该事件使我的应用程序崩溃。

UITableViewCell *cell = [tableVw dequeueReusableCellWithIdentifier:@"BannerAdCellIdentifier"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"BannerAdCellIdentifier"] autorelease];
}
[[cell viewWithTag:9999] removeFromSuperview];

ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
adView.tag = 9999;
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
[cell addSubview:adView];
[adView release];

return cell;

我想既然我没有设置广告的委托,那么这将不会出现任何与内存相关的问题。

What is the best-practice for placing ads in your table view cells? Here's my code, which works until the banner receives the transitionToNextBanner event, which then crashes my app.

UITableViewCell *cell = [tableVw dequeueReusableCellWithIdentifier:@"BannerAdCellIdentifier"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"BannerAdCellIdentifier"] autorelease];
}
[[cell viewWithTag:9999] removeFromSuperview];

ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
adView.tag = 9999;
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
[cell addSubview:adView];
[adView release];

return cell;

I thought since I'm not setting the ad's delegate that this would be safe from any memory-related issues.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉月流沐 2024-09-20 01:16:43

如果您将 iAd 横幅放置在表格视图单元格中,Apple 很可能会拒绝您的申请。原因是表视图单元格能够多次在屏幕上移动和移出屏幕(有时会导致重新创建/重新加载单元格或其内容)。

由于 iAds 按点击次数和每次展示次数付费,因此这将是一种产生大量展示次数并通过展示次数获得更多收入的简单方法。苹果不会允许这种情况发生。

iAd 指南规定 iAd 横幅应位于固定位置,而不是在滚动视图内。它还指出,如果 iAd 由于某种原因无法加载,您的应用程序不应在其应有的位置留下空白。最后一点可能纯粹是出于审美目的,我不知道。

Apple will very likely reject your application if you place iAd banners within table view cells. The reason being that table view cells have the ability to move on and off screen multiple times (sometimes resulting in recreating/reloading the cell or its contents).

Since iAds pay out both per click and per impression, this would be an easy way to generate a lot of impressions and get more money through impressions. Apple aren't going to allow this.

The iAd guidelines state that iAd banners should be in a fixed spot, and not within a scroll view. It also states that if an iAd fails to load for whatever reason, your app shouldn't leave a blank space where it would have been. The last point may be purely aesthetic, I don't know.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文