Jor*_*anC 6 iphone cell uitableview admob
我正在尝试将AdMob广告添加到表格视图中.
我希望它出现在每10个单元格中.(例如,如果有的话,就像Reddit App的免费版本一样).
我试图遵循AdMob文档,但我没有运气,我确信有一些我遗漏的东西.
有没有人可以通过一种简单的方式来解决这个问题?谢谢!
Dav*_*des 16
我使用的代码基本上是这样的:
int row = [indexpath row];
if (0 == (row % 10)) { // or 9 == if you don't want the first cell to be an ad!
static NSString *MyIdentifier = @"AdCell";
cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
}
[cell.contentView addSubview:[AdMobView requestAdWithDelegate:self]];
} else {
// make your normal cells
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5554 次 |
| 最近记录: |