title: UICollectionView reloads wrong images on scroll
body: <p>In the code below, I download image URLs from a text file, store it in a NSMutableArray, then download the images from from those URLS in CellforItemAtIndexPath. However, when I scroll up and down, for a brief moment, the wrong image is in the wrong place. It corrects a second later but I would like to get rid of that scrolling problem. Here's the code:</p>
  
  <pre><code>- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
      static NSString *identifier = @"Cell2";
  
      UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
      AsyncImageView *recipeImageView = (AsyncImageView *)[cell viewWithTag:100];
      UILabel *titleView = (UILabel *)[cell viewWithTag:101];
      titleView.numberOfLines = 3;
      UIImageView *overlay = (UIImageView *)[cell viewWithTag:111];
      FXBlurView *blurView = (FXBlurView *)[cell viewWithTag:110];
      blurView.tintColor = [UIColor colorWithRed:51.0 green:51.0 blue:51.0 alpha:1];
  
  
      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
          hi = [self videoTitle];
          images = [self firstPhoto];
          // switch to a background thread and perform your expensive operation
  
  
          // switch back to the main thread to update your UI
  
  
          dispatch_async(dispatch_get_main_queue(), ^{
              NSString *imgSrc;
  
              NSString *url = images[indexPath.row];
              imgSrc = url;
              if (imgSrc != nil &amp;&amp; [imgSrc length] != 0 ) {
                  [recipeImageView setImageWithURL:[NSURL URLWithString:images[indexPath.row]] placeholderImage:[UIImage imageNamed:@"red.png"]];
  
              }
              else {
                  NSLog(@"noimage");
                  recipeImageView.image = [UIImage imageNamed:@"red.png"];
              }
              titleView.text = hi[indexPath.row];
  
  
          });
      });
  
      return cell;
  
  
      // recipeImageView.image = [UIImage imageNamed:[videoList objectAtIndex:indexPath.row]];
  
  }
  </code></pre>
  
  <p>Any ideas? Thank you.</p>