title: UICollectionView will recreate cells when calling the "reloadItems" method
body: <p>My cell has an image which be downloaded from network, therefore I need to set the height of cell as dynamic.
  When an image download is finished, I am going to call <code>self.collectionView.reloadItems(at: [indexPath])</code> to trigger the delegate method for setting a new height.</p>
  
  <p>But it seems that the <code>reloadItems</code> method will recreate a cell, not just re-layout an original reuse cell.</p>
  
  <p><a href="https://i.stack.imgur.com/7vK2q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7vK2q.png" alt="enter image description here"></a></p>
  
  <p>How can I solve this problem? Is it a bug on UICollectionView from apple or something wrong I did? </p>
  
  <p>Whole code: </p>
  
  <pre><code>// code from ViewController
  func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
  
      let cell = collectionView.dequeueReusableCell(withReuseIdentifier: AnnounmentWallCollectionViewCell.cellIdentifier, for: indexPath) as! AnnounmentWallCollectionViewCell
  
      let announcement = announcements[indexPath.row]
      cell.collectionView = collectionView
      cell.setBanner(from: announcement.banner, indexPath: indexPath, completion: { [unowned self] (height) in
          self.bannersHeight[indexPath.row] = height
      })
      cell.setHTMLContent(announcement.content)
      contentsHeight[indexPath.row] = cell.htmlContentSize.height
      printD("indexPath: \(indexPath)")
      return cell
  }
  
  // code from cell
  func setBanner(from url: URL?, indexPath: IndexPath, completion: @escaping (_ height: CGFloat)-&gt;()) {
      // URL(string: "https://i.imgur.com/qzY7BJ9.jpg")
      if let url = url {
          if let banner = SDImageCache.shared().imageFromDiskCache(forKey: url.absoluteString) {
              self.bannerView.isHidden = false
              self.bannerView.image = banner.scaleWidth(to: self.bounds.width - 32) // leading + trailling
              self.bannerHeight.constant = self.bannerView.image?.size.height ?? 1
              completion(self.bannerHeight.constant)
              printD("NO Download: \(indexPath)")
              let animationsEnabled = UIView.areAnimationsEnabled
              UIView.setAnimationsEnabled(false)
              self.collectionView.reloadItems(at: [indexPath])
              UIView.setAnimationsEnabled(animationsEnabled)
          } else {
              DispatchQueue.global().async {
                  SDWebImageDownloader.shared().downloadImage(with: url, options: .useNSURLCache, progress: nil) { (banner, data, error, finished) in
                      DispatchQueue.main.async {
                          if let banner = banner {
                              SDImageCache.shared().store(banner, forKey: url.absoluteString, toDisk: true)
                              self.bannerView.isHidden = false
                              self.bannerHeight.constant = banner.scaleWidth(to: self.bounds.width - 32)?.size.height ?? 1
                              completion(self.bannerHeight.constant)
                              self.collectionView.reloadData()
                              printD("Download: \(indexPath): \(self.bannerHeight.constant)")
                          } else {
                              self.bannerView.isHidden = true
                              self.bannerHeight.constant = 1
                              completion(self.bannerHeight.constant)
                          }
                      }
                  }
              }
          }
      } else {
          bannerView.isHidden = true
          bannerHeight.constant = 1
          completion(bannerHeight.constant)
      }
  }
  
  // code from delegate 
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -&gt; CGSize {
      let width = self.view.bounds.width
      let height = bannersHeight[indexPath.row] + contentsHeight[indexPath.row]
          + 1 // sticker
          + 11 // banner top
      printD("indexPath: \(indexPath): \(height)")
      return CGSize(width: width, height: height)
  }
  </code></pre>