Scenario
I have an application in which I display data to the user in PFQueryTableViewController. Everything works for me as it should, with the exception of images. When I reuse a cell that is already loaded in the image, this image tends to stay in the cell the next time it is deleted in cellForRowAtIndexPath. And when Im scrolls, sometimes they change when I scroll back to look at them again.
The code I use to populate my image
-(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];
}];
}
}];
}
Question
Does anyone know how to upload an image and save this image in this cell for this index, and only this index and save it there?