Alamofire-image loading wrong Image inside uicollectionview cell

Viewed 951

i have been using alamofire-image library to display image from url inside uicollectionview cell.

i have noticed that most of time its displays the right image but sometimes displays wrong image(most of the time previous cell image). how to overcome this problem.

      func collectionView(collectionView: UICollectionView,
        cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {

          let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell",forIndexPath: indexPath) as! myCollectionViewCell

          cell.titleLabelCell.text = element[indexPath.row]["title"]
          cell.generLabelCell.text  = element[indexPath.row]["gener"]

          let URL = NSURL(string: "\(element[indexPath.row]["banner_site_url"])" )!

          cell.mImageView.af_setImageWithURL(URL)

          return cell
      }
1 Answers
Related