- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if(contentRows == 0) { return 0; } else if(adDidLoad) { if(section == kAdSection) { return contentRows > kAdSectionRowOffset ? contentRows - kAdSectionRowOffset : 0; } else { return contentRows >= kAdSectionRowOffset ? kAdSectionRowOffset : contentRows; } } else { if(section == kTopSection) { return contentRows; } else { return 0; } } } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { if(section == kAdSection && adDidLoad) { return adView; } return nil; }