-1
我正在使用AdMob在我的UITableView
中顯示廣告。它工作正常,但當廣告更改單元格時,我在表格中獲取空單元格。隱藏空UITableViewCell
我怎樣才能隱藏舊的和空的單元格?見圖片的問題
- (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;
}
}
廣告更改地點如何?你可以發佈一些可能有助於解決問題的代碼嗎? – propstm
我相信當[cell addSubView:_banner]被調用時,廣告正在改變單元格。我已經添加了代碼。 – ErikTJ