title: UITableViewCell Delete content
body: <p>I am having trouble with the reusable aspect of my UITableViewCell.  I have different type of data going into the different cells.  When the types of data are the same (example: only images) I have no problem because the new image over writes the old one.  But when the types of data are the same they both are sticking around.</p>
  
  <p>I'm looking for methods or tools for clearing a cell completely.  I have tried many things such as dictionaries to reference the data directly and erase it but that failed because I couldn't consistently tell what data was in what reused cell (especially when scrolling a lot). Others things were</p>
  
  <pre><code> cell.contentView.subviews.removeAll()
  </code></pre>
  
  <p>threw error, another was</p>
  
  <pre><code>cell.contentView.removeFromSuperView()
  </code></pre>
  
  <p>but that just made the cell useable and nothing loaded ever.</p>
  
  <p>my code is below, thanks if advance for the help (ignore the date stuff).</p>
  
  <pre><code> if dictionary?["type"]! != nil {
  
  
                  cell.imageView?.layer.borderColor = UIColor.black.cgColor
                  cell.layer.borderWidth = 1
                  cell.imageView?.layer.cornerRadius = 1
  
  
                  cell.imageView?.frame = CGRect(x: 0, y: UIScreen.main.bounds.height/2, width: 25, height: 25)
  
                  self.tableTextOverLays(i: indexPath.row, type: Int((dictionary?["type"])! as! NSNumber), cell: cell)
  
                  if (indexPath.row == tableFeedCount - 1) &amp;&amp; lockoutFeed != true &amp;&amp; tableFeedCount == self.allDictionary.count &amp;&amp; imageFeedCount == imageDictionary.count {
                      let dictionary = self.allDictionary[indexPath.row]
                      let date = dictionary?["date"] as! Double
                      let date2 = date*100000
                      let date3 = pow(10,16) - date2
                      let date4 = String(format: "%.0f", date3)
                      self.setUpFeed(starting: date4, queryLimit: UInt(11))
                  }
  
  
              }
  
              else if (dictionary?["type_"] as! String) == "Image" {
                  print("image feed", indexPath.row)
  
  
  
                  cell.imageView?.layer.borderColor = UIColor.black.cgColor
  
                  cell.layer.borderWidth = 1
                  cell.imageView?.layer.cornerRadius = 1
                  cell.imageView?.frame = CGRect(x: 0, y: UIScreen.main.bounds.height/2, width: 25, height: 25)
                  cell.imageView?.image = imageDictionary[indexPath.row]
  
                  if indexPath.row == tableFeedCount - 1 &amp;&amp; lockoutFeed != true &amp;&amp; tableFeedCount == self.allDictionary.count &amp;&amp; imageFeedCount == imageDictionary.count{
                      let dictionary = self.allDictionary[indexPath.row]
                      let date = dictionary?["date"] as! Double
                      let date2 = date*100000
                      let date3 = pow(10,16) - date2
                      let date4 = String(format: "%.0f", date3)
  
                      setUpFeed(starting: date4, queryLimit: UInt(11))
                  }
  
  
              }
              else if (dictionary?["type_"] as! String) == "Video" {
                  print("video feed", indexPath.row)
  
  
  
                  cell.imageView?.layer.borderColor = UIColor.black.cgColor
  
                  cell.layer.borderWidth = 1
  
                  let imagerView = UIImageView()
                  imagerView.layer.cornerRadius = 1
                  imagerView.frame = CGRect(x: 0, y: 0, width: 200, height: 200)
                  imagerView.image = videoDictionary[indexPath.row]
  
  //                let vidUIView = UIView()
  //                vidUIView.tag = indexPath.row
  
                  let asf = UITapGestureRecognizer(target: self, action: #selector(ProfileController.playVid2(gestureRecognizer:)))
                  asf.numberOfTapsRequired = 2
  //                imagerView.addGestureRecognizer(asf)
  
  
                  let adsf = UITapGestureRecognizer(target: self, action: #selector(ProfileController.playVid(gestureRecognizer:)))
                  adsf.numberOfTapsRequired = 1
                  adsf.require(toFail: asf)                
  //              imagerView.addGestureRecognizer(adsf)
  
                  cell.contentView.addGestureRecognizer(asf)
                  cell.contentView.addGestureRecognizer(adsf)
  
                  cell.contentView.frame = CGRect(x: 0, y: 0, width: 200, height: 200)
  
                  cell.contentView.addSubview(imagerView)
  
                  //cell.contentView.addSubview(vidUIView)
  
  
                  if indexPath.row == tableFeedCount - 1 &amp;&amp; lockoutFeed != true &amp;&amp; tableFeedCount == self.allDictionary.count &amp;&amp; videoFeedCount == videoDictionary.count{
                      let dictionary = self.allDictionary[indexPath.row]
                      let date = dictionary?["date"] as! Double
                      let date2 = date*100000
                      let date3 = pow(10,16) - date2
                      let date4 = String(format: "%.0f", date3)
  
                      setUpFeed(starting: date4, queryLimit: UInt(11))
                  }
  
              }
  </code></pre>