title: UITableViewCell with a UIView subclass creates multiple layers on cell
body: <p>I have an custom UITableViewCell created with (.xib) and have UIView subclass instance inside cell created from code</p>
  
  <p>table delegate method :</p>
  
  <pre><code> func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
      let cell = tableView.dequeueReusableCellWithIdentifier("CustomCellOne", forIndexPath: indexPath) as! CustomOneCell
      let woView = ModuleView(frame: CGRect(x: 10, y: 10, width: 400, height: 400))
      woView.addBehavior(self.modulesForSubjects[indexPath.row])
  
      // remove subviews
      for subview in cell.subviews{
          subview.removeFromSuperview();
      }
  
      // then add your view
      cell.wiView = woView
  
      return cell
  }
  </code></pre>
  
  <p>my full UIView subclass :</p>
  
  <pre><code>class ModuleView: UIView {
  override init (frame : CGRect) {
      super.init(frame : frame)
  }
  
  convenience init () {
      self.init(frame:CGRect.zero)
  }
  
  required init(coder aDecoder: NSCoder) {
      fatalError("This class does not support NSCoding")
  }
  
  
  func addBehavior (ArrayOfmodulesForSubject: [SubjectsModules]) {
      var number :CGFloat = 30
      var number2 :CGFloat = 30
  
      print(ArrayOfmodulesForSubject.count)
      for  (i, index) in ArrayOfmodulesForSubject.enumerate()  {
  
      let yourLabel1 = UILabel(frame: CGRectMake(number, 40 , 35 , 30))
      let yourLabel2 = UILabel(frame: CGRectMake(number2, 60 , 140 , 30))
      yourLabel1.textColor = UIColor.whiteColor()
      yourLabel1.backgroundColor = UIColor.redColor()
      yourLabel1.text = String(index.score)
  
      yourLabel2.textColor = UIColor.whiteColor()
      yourLabel2.backgroundColor = UIColor.blackColor()
      yourLabel2.text = index.date
  
      self.addSubview(yourLabel1)
      self.addSubview(yourLabel2)
      number += 30
      number2 += 70
      }
  
  
  }
  </code></pre>
  
  <p>here is what i get after some scrolling:</p>
  
  <p><a href="https://i.stack.imgur.com/wJz95.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wJz95.png" alt="multiple layers of labels"></a></p>
  
  <p><strong>UPDATE</strong>  rnsjtngus solution, unfortunately also didn't helped (maybe im doing something wrong) </p>
  
  <pre><code>class CustomOneCell: UITableViewCell {
  var arr  = [SubjectsModules]()
  @IBOutlet weak var wiView: ModuleView!
  override func setSelected(selected: Bool, animated: Bool) {
      super.setSelected(selected, animated: animated)
  
      // Configure the view for the selected state
  }
  
  override init(style: UITableViewCellStyle, reuseIdentifier: String?){
  
      // Initialize your custom cell
  
      super.init(style: style, reuseIdentifier: reuseIdentifier)
      self.setupWoView(self.arr)
  }
  override func awakeFromNib() {
  
      print("AWAKED FROM NIB")
      for subview in subviews{
          subview.removeFromSuperview()
          if superview != nil {
          superview!.removeFromSuperview()
          }
      }
  
  }
  
  required init?(coder aDecoder: NSCoder) {
      super.init(coder: aDecoder)
  }
  
  func setupWoView(arrayOfmodulesForSubject: [SubjectsModules]) {
      let woView = ModuleView(frame: CGRect(x: 10, y: 10, width: 400, height: 400))
      woView.backgroundColor = UIColor.blueColor()
      self.addSubview(woView)
  }
  </code></pre>
  
  <p>}</p>