views:

387

answers:

1

Hi guys, 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!

+1  A: 

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
}
David Maymudes
Absolute Legend!Thanks a lot this really helped.
JordanC