I am trying to add an AdMob ad to a table view.
I would like it to show up in every 10th cell. (Eg. like how it is in the Free version of the Reddit App if you have it).
I tried to follow the AdMob documentation but I didn't have any luck and I'm sure there is something I am missing.
Could anyone shine some light on a simple way to do this? Thanks!
I've used code basically like this:
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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With