title: Hide button in UICollectionView cell
body: <p>I am programmatically creating cells and adding a delete button to each one of them. The problem is that I'd like to toggle their .hidden state. The idea is to have an edit button that toggles all of the button's state at the same time. Maybe I am going about this the wrong way?</p>
  
  <pre><code>func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
      let cell = collectionView.dequeueReusableCellWithReuseIdentifier("verticalCell", forIndexPath: indexPath) as! RACollectionViewCell
      let slide = panelSlides[indexPath.row]
      cell.slideData = slide
      cell.slideImageView.setImageWithUrl(NSURL(string: IMAGE_URL + slide.imageName + ".jpg")!)
      cell.setNeedsLayout()
  
      let image = UIImage(named: "ic_close") as UIImage?
      var deleteButton = UIButton(type: UIButtonType.Custom) as UIButton
      deleteButton.frame = CGRectMake(-25, -25, 100, 100)
      deleteButton.setImage(image, forState: .Normal)
      deleteButton.addTarget(self,action:#selector(deleteCell), forControlEvents:.TouchUpInside)
      deleteButton.hidden = editOn
      cell.addSubview(deleteButton)
      return cell
  }
  
  
  @IBAction func EditButtonTap(sender: AnyObject) {
      editOn = !editOn
      sidePanelCollectionView.reloadData()
  }
  </code></pre>