滚动时UITableView加载相同的图像(Parse.com SDK)

时间:2014-10-23 10:04:08

标签: ios uitableview parse-platform

情景

我有一个应用程序,我在PFQueryTableViewController中向用户显示数据。除了图像之外,我完全按照应有的方式工作。当我重用已经加载到图像中的单元格时,该图像在下一次在cellForRowAtIndexPath中出列时往往会留在单元格上。当我滚动时有时它们会在我向上滚动以再次查看它们时发生变化。

代码我用来填充我的图片

-(PFTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {

        PFFile *imgFile = object[@"picture"];
        cell.picture.file = imgFile;

        [cell.picture loadInBackground:^(UIImage *image, NSError *error) {

            if (!error) {

                [indexArray addObject:[NSNumber numberWithInt:indexPath.row]];

                [UIView animateWithDuration:.35 animations:^{

                    cell.picture.alpha = 1.0;
                    [cell.indicator setHidesWhenStopped:YES];
                    [cell.indicator stopAnimating];

                }];

            }

        }];

}

问题

是否有人知道如何加载图像并将该图像保留在该索引的单元格上,并且只保留该索引并将其保留在那里?

0 个答案:

没有答案