I am using AdMob to display ads in my UITableView. It is working fine but i am getting empty cells in my table when the ad changes cell.
How can i hide the old and empty cell? See picture for the problem

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
int row = [indexPath row];
NSString *CellIdentifier = @"Cell";
if(kAdFrequency - 1 == row%kAdFrequency){
CellIdentifier = @"AdCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
[cell addSubview:_banner];
return cell;
}else{
row = row - floor((float)row/kAdFrequency);
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NGNationEventDay* day = [_events objectAtIndex:indexPath.section];
NGNationEvent* event = [day.events objectAtIndex:row];
cell.textLabel.text = event.name;
cell.detailTextLabel.text = event.category;
return cell;
}
}
I think in general the best way of doing this would be just to make sure that your ads are showing up at a frequency where there are never two ad cells on screen at once (you can probably just modify kAdFrequency to make this the case).