title: iOS 8 Swift UICollectionView reloadData() causing views (images) to jump cells
body: <p>I have a <code>UICollectionView</code> of 20 cells with an <code>imageView</code> inside of them. when a user clicks on the correct cell, I draw another <code>imageView</code> in that cell (a correctCircle let's call it). This works fine. </p>
  
  <p>But I also have a header in the <code>UICollectionView</code> where I ask the question they need to answer. After each click (wait 2 secs) the question should be updated, I have a function that updates the label for the Header text, this also works fine. </p>
  
  <p>My problem is:
  In order to update the Header text, I have to call <code>uicollectionView.reloadData()</code> and whenever I do that, the <code>UIImageView</code> that I drew in the cell (the correctCircle) gets moved to another cell!</p>
  
  <p>I've tried everything I can think of, including solutions in this thread:
  <a href="https://stackoverflow.com/questions/18796891/uicollectionview-reloaddata-not-functioning-properly-in-ios-7">UICollectionView reloadData not functioning properly in iOS 7</a></p>
  
  <p>But can't get it to work. Any ideas are more than welcome. Ideally I would only refresh the header and not the rest of the cells but there doesn't seem to be a way to do that.</p>
  
  <p><strong>Edit:</strong> slightly altering code based on comments, now I have 2 images in each cell and one is hidden, then I show it, instead of adding an <code>imageView</code> upon click.</p>
  
  <p>Here's some relevant code:</p>
  
  <pre><code>override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
          let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as CollectionViewIconCell    
  
          // bigIcon() just returns the animal's icon image
          cell.icon.image = animalsArray[indexPath.row].bigIcon()
  
          return cell
      }
  
  override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
          // we cannot use a dequeueReusableCellWithReuseIdentifier, we need this
          let cell = collectionView.cellForItemAtIndexPath(indexPath) as CollectionViewIconCell
  
          if currentAnimal == self.correctAnimal {
              cell.circleImage.image = correctCircleImage
              cell.circleImage.hidden = false
  
              correctAnswers++
  
              // nextQuestion() simply loads the text that will go in the Header.label
              self.nextQuestion()
              self.collectionView!.reloadData()
  
          } else {
              self.answerCircle.image = UIImage(named: "wrongCircle")
              self.answerCircle.sizeToFit()
              cell.addSubview(answerCircle)
  
              self.nextQuestion()
              self.collectionView!.reloadData()
          }        
      }
  </code></pre>
  
  <p>Thanks.</p>
  
  <p><strong>PS</strong></p>
  
  <p>Reading some of the comments, maybe I'm not setting the text for the header correctly on a new question? I got all this code from tutorials, very new to UICollectionView so excuse my ignorance but is there a better way to refresh the header text? I can't get the header outside of the <code>viewForSupplementaryElementOfKind</code> function.</p>
  
  <p>I should explain I have 2 different imageViews, one for correct answer and one for wrong answer because the circe for correct answer should remain while the one for wrong answer will be removed on each question and reused.   </p>