TableViewCell复用数据重复问题解决

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
  // 定义唯一标识
static NSString *CellIdentifier = @"Cell";
  // 通过indexPath创建cell实例 每一个cell都是单独的
 
 //只需要这里替换成自己自定义的cell就可以了
 UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
  if (!cell) {
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
 return cell;
 }

你可能感兴趣的:(TableViewCell复用数据重复问题解决)