-1
我有一個問題,在加載時tableView中的所有單元格都是重複的。我如何防止這種情況?代碼如下:UITableView重複每個單元格
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
PoliticianDetailsD *politician =[self.politicianDetails objectAtIndex:indexPath.row];
if ((NSString *)[NSNull null] == politician.first_name) {
cell.textLabel.text = [NSString stringWithFormat:@"%@", politician.last_name];
}
else if ((NSString *)[NSNull null] != politician.first_name) {
cell.textLabel.text = [NSString stringWithFormat:@"%@ %@", politician.first_name, politician.last_name];
}
return cell;
}
是的,它是愚蠢的對不起:) – ch1pa
沒有問題! – SFF