title: cell.contentView.viewWithTag vs cell.viewWithTag in didSelectItemAtIndexPath works different
body: <p>My <code>UICollectionView</code> has a <code>UILabel</code> and a <code>UIImageView</code>, i figure it them and works well like this:</p>
  
  <pre><code> func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell{
          let cell = collectionView.dequeueReusableCellWithReuseIdentifier("coffee_brand_cell", forIndexPath: indexPath) //as! AURCoffeeBrandCollectionViewCell
          let imageView = cell.contentView.viewWithTag(1) as? UIImageView
  
          imageView?.image = UIImage(named: ["coffee1","coffee2","coffee3","coffee3"][indexPath.row])
          let name = cell.contentView.viewWithTag(2) as? UILabel
          name?.text = coffeeName[indexPath.row] + String(indexPath.row)
          name?.textColor = UIColor(red: 226.0/255.0, green: 170.0/255.0, blue: 119.0/255.0, alpha: 1.0)
          name?.adjustsFontSizeToFitWidth = true
          cell.backgroundColor = collectionView.backgroundColor
          cell.layoutIfNeeded()
          imageView?.layer.cornerRadius = (cell.frame.width - 40)/2.0
          imageView?.layer.masksToBounds = true
  
          return cell
      }
  </code></pre>
  
  <p>But i can't get the selected cell's name and image like below,</p>
  
  <pre><code>func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
             let cell = collectionView.cellForItemAtIndexPath(indexPath)
              if let name = cell?.contentView.viewWithTag(2) {
                  //Can't get into this.
              }
      }
  }
  </code></pre>
  
  <p>and cell's contentView subviews return 0.</p>
  
  <pre><code>cell!.contentView.subviews
  0 elements
  </code></pre>
  
  <p><strong>Update</strong>:</p>
  
  <p><code>cell.contentView.viewWithTag(2)</code> works in <code>cellForItemAtIndexPath</code>, but not in <code>didSelectItemAtIndexPath</code>. however <code>cell.viewWithTag(2)</code> works.</p>
  
  <p>Why <code>contentView</code>works different? </p>
  
  <p><strong>update</strong></p>
  
  <p>Insert this two lines into <code>didSelectItemAtIndexPath</code></p>
  
  <pre><code>        print(" selected cell is \((cell?.viewWithTag(2) as! UILabel).text!)")
          print(" selected cell is \((cell?.contentView.viewWithTag(2) as! UILabel).text!)")
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>selected cell is Kii Kenya0
  fatal error: unexpectedly found nil while unwrapping an Optional value
  </code></pre>
  
  <p>Project can be download here: <a href="http://github.com/williamhqs/testCollectionView/archive/master.zip" rel="nofollow noreferrer">Link</a></p>
  
  <p>PS: I checked the 'Installed' for the contentView's subViews.
  <a href="https://i.stack.imgur.com/AOEXJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AOEXJ.png" alt="enter image description here"></a> 
  CollectionView in simulator.
  <a href="https://i.stack.imgur.com/yxM62.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yxM62.png" alt="enter image description here"></a></p>