title: CollectionView scrolling changes the selected cells
body: <p>CollectionView scrolling changes the selected cells. For example, there are 26 letters in my collectionView, items[0] is A, items[1] is B, ... items[25] is Z, now I selected items[1], it is B, and when I scroll the collectionView, items[1] will become deselected and there is another item will be selected. I know the problem is caused by Reuse but I don't know how to fix it properly even I use some solution that showed in google or StackOverflow.</p>
  
  <p>My viewDidLoad:</p>
  
  <pre><code>collectionView.allowsMultipleSelection = false
  </code></pre>
  
  <p>My CollectionViewCell Class:</p>
  
  <pre><code>import UIKit
  class AddCollectionViewCell: UICollectionViewCell {
  }
  </code></pre>
  
  <p>My CollectionView Setting:</p>
  
  <pre><code>func numberOfSections(in collectionView: UICollectionView) -&gt; Int {
          return 1
      }
  func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
          return iconSet.count
      }
  func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
  let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "iconCell", for: indexPath) as! IconCollectionViewCell
          cell.iconImage.image = UIImage(named:iconSet[indexPath.row])
          return cell
  
      }
  </code></pre>
  
  <p>My CollectionView's didSelecteItemAt function:</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  
          if let cell = collectionView.cellForItem(at: indexPath) {
              cell.backgroundColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.3)
              cell.backgroundView?.layer.cornerRadius = 5
          }
  </code></pre>
  
  <p>My CollectionView's didDeSelecteItemAt function:</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
  
          if let cell = collectionView.cellForItem(at: indexPath) {
              cell.backgroundColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.0)
              cell.backgroundView?.layer.cornerRadius = 5
          }
      }
  </code></pre>