Ios tableView重新加载中的IndexPath问题

Ios tableView重新加载中的IndexPath问题,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我正面临这样的麻烦,我们走吧: 我有一个tableView,它已经加载了一系列数组,这个过程非常有效,但是,当我更新tableView重载时,即使使用相同的数组,卷轴也被定位在列表的一半,或者最后,似乎索引加载错误,也就是说,当加载单元格时,加载另一个单元格的信息。另一方面,如果滚动条位于tableview的顶部,即在第一个单元格中,即使在重新加载过程中,也不会发生此问题,请使用下面的代码: 非常感谢 - (UITableViewCell *)tableView:(UITableView

我正面临这样的麻烦,我们走吧:

我有一个tableView,它已经加载了一系列数组,这个过程非常有效,但是,当我更新tableView重载时,即使使用相同的数组,卷轴也被定位在列表的一半,或者最后,似乎索引加载错误,也就是说,当加载单元格时,加载另一个单元格的信息。另一方面,如果滚动条位于tableview的顶部,即在第一个单元格中,即使在重新加载过程中,也不会发生此问题,请使用下面的代码:

非常感谢

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {

static NSString *CellIdentifier = @"cell_aux";

clsTableViewCell *cell = (clsTableViewCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil)
{
    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"cell_aux" owner:self options:nil];
    cell = (clsTableViewCell *)[nib objectAtIndex:0];
}

[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];

arInfos = [[NSArray alloc] initWithArray:[[arMain objectAtIndex:indexPath.row]                  componentsSeparatedByString:@"|"]];

[arInfosAll addObject:arInfos];

NSURL *imgURL = [NSURL URLWithString:[arInfos objectAtIndex:4]];

UIImage *Noimg=[UIImage imageNamed:@"NoImage.png"];
cell.img.image = Noimg;


cell.lblNome.text = [arInfos objectAtIndex:1];
cell.lblEndereco.text =[arInfos objectAtIndex:2];

NSURLRequest* request = [NSURLRequest requestWithURL:imgURL];
[NSURLConnection sendAsynchronousRequest:request
                                       queue:[NSOperationQueue mainQueue]
                           completionHandler:^(NSURLResponse * response,
                                               NSData *imgData,
                                               NSError * error)
    {
                               if (!error)
                               {
                                   UIImage *img = [UIImage imageWithData:imgData];
                                   cell.img.image = img;
                               }

                           }];
    }

      return cell;
  }

您可能希望尝试在cellForIndexPath和完成处理程序中插入NSLog。我敢打赌,您的大多数问题都是因为如果异步映像加载。您是否尝试过使用SDWebImage..在cell.imgView.image..中加载imageURL。。!我认为您使用的请求产生了问题…异步映像加载的实现不正确。在您发布的方法中,单元格应该从模型中读取图像,在另一个方法willDisplayCellAtIndexPath中,您应该发送异步调用,在回调中,将图像保存到modelHi,各位。不幸的是,我认为问题不在于SDWebImage。我已经在没有异步实现的情况下测试了代码,但是它不起作用。这个问题一直没有解决。