-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