title: UICollectionView not working as intended
body: <p>I'm a new iOS developer, so bear with me if i'm missing something obvious. I want to develop an application with swift that has iOS 7 and 8 compatibility.</p>
  
  <p>My custom view controller contains a UICollectionView and a UITableView. When the user selects a cell in the Collection view, appropriate changes are made to the table view. I use a custom UICollectionViewCell like below.</p>
  
  <pre><code>class CategoryCollectionViewCell: UICollectionViewCell {
    @IBOutlet weak var imageView:UIImageView!
    @IBOutlet weak var textView:UILabel!
  
    var categoryInfo: String!
  }
  </code></pre>
  
  <p>Also, this is the implementation for the view controller:</p>
  
  <pre><code>class FeedViewController: MainPagesViewController, UITableViewDelegate, UITableViewDataSource, UICollectionViewDataSource, UICollectionViewDelegate {
  
      @IBOutlet weak var tableView:UITableView!
      @IBOutlet weak var collectionView:UICollectionView!
  
      var shownData:[String] = []
      var selectedCell: String = ""
  
  override func viewDidLoad() {
      super.viewDidLoad()
      self.shownData = self.collectionData(self.selectedCell)
      self.collectionView.registerNib(UINib(nibName: "CategoryCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "CategoryCells")
      self.collectionView.allowsMultipleSelection = true
  }
  
  //    MARK: Collection View
  func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
      let cell = collectionView.dequeueReusableCellWithReuseIdentifier("CategoryCells", forIndexPath: indexPath) as CategoryCollectionViewCell
      cell.layer.cornerRadius = 5.0
      cell.clipsToBounds = true
      if indexPath.item == 0 {
          cell.textView.text = ""
          cell.imageView.image = UIImage(named: "back")
          cell.userInteractionEnabled = false
          return cell
      }
      cell.imageView.image = nil
      cell.categoryInfo = self.shownData[indexPath.item - 1]
      cell.textView.text = cell.categoryInfo
      return cell;
  }
  
  func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
      collectionView.deselectItemAtIndexPath(indexPath, animated: false)
      if(indexPath.item == 0){
          self.shownData = self.collectionData("back")
          collectionView.reloadData()
          self.refreshTableView()
      }
      else {
          self.shownData = self.collectionData(self.selectedCell)
          collectionView.reloadData()
          self.refreshTableView()
      }
  }
  
  func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
      return self.shownData.count + 1
  }
  
  func numberOfSectionsInCollectionView(collectionView: UICollectionView) -&gt; Int {
      return 1
  }
  
  func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -&gt; CGSize {
      if (indexPath.item == 0){
          return CGSize(width: 30, height: 30)
      }
      var sizingCell = (UINib(nibName: "CategoryCollectionViewCell", bundle: nil).instantiateWithOwner(nil, options: nil))[0] as CategoryCollectionViewCell
      sizingCell.textView.text = self.shownData[indexPath.item - 1]
      sizingCell.setNeedsLayout()
      sizingCell.layoutIfNeeded()
      let size = sizingCell.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize)
      return CGSize(width: size.width + 1, height: 30)
  }
  
  func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, estimatedItemSize indexPath: NSIndexPath) -&gt; CGSize {
      if (indexPath.item == 0){
          return CGSize(width: 30, height: 30)
      }
      return CGSize(width: 80, height: 30)
  }
  
  
  
  }
  </code></pre>
  
  <p>collectionData() is a function that sets the labels to be shown in collection view cells. refreshTableView() makes changes to the table view. MainPagesViewController is a simple UIViewController with some variables. Also, the collection view uses flow layout with Horizontal scroll direction.</p>
  
  <p>When the application is tested in an iPhone simulator, the first touch to the cells call didSelectItemAtIndexPath(). But after reloading the collection view with reloadData(), only some of the cells call the didSelectItemAtIndexPath() and the touch is not registered  with all of them.</p>
  
  <p>Thanks in advance.</p>