I also used that trick, but the threads and the indexes between threads make a mess so I searched and I found a great library on GitHub.
You just need to #import <SDWebImage/UIImageView+WebCache.h>
to your project, and you can define also the placeholder when image is being downloaded with just this code:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
MyCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MyCell"
forIndexPath:indexPath];
DLog(@"url at index %d : %@", indexPath.row, ((MyObject *)[self.list.array objectAtIndex:indexPath.row]).imageUrl);
MyObject *object = (MyObject *)[self.list.array objectAtIndex:indexPath.row];
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
return cell;
}
It also cache downloaded images and gives you great performance.
Hope it will help you!