简体   繁体   English

UITableViewCell中的ADBannerView

[英]ADBannerView in UITableViewCell

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. 这是我的代码,直到横幅接收到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;

I thought since I'm not setting the ad's delegate that this would be safe from any memory-related issues. 我以为,由于我没有设置广告的委托人,因此可以避免与内存相关的任何问题。

Apple will very likely reject your application if you place iAd banners within table view cells. 如果将iAd标语放置在表格视图单元格中,Apple很可能会拒绝您的申请。 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. 由于iAd会为每次点击和每次展示支付费用,因此这是一种产生大量展示并通过展示获得更多收益的简便方法。 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. iAd准则规定,iAd标语应位于固定位置,而不应位于滚动视图内。 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. 它还指出,如果iAd出于任何原因无法加载,则您的应用都不应在原本应该留有空白的地方。 The last point may be purely aesthetic, I don't know. 最后一点可能纯粹是美学,我不知道。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM