title: How to create Custom UITableViewCell with dynamic number of labels
body: <p>each custom cell in tableview can either have one or two or three or more labels depending on the number of data return from api.</p>
  
  <p>I've tried creating dynamic number of labels into cell in cellForRowAtIndexPath method. But every time I scroll, all these labels overlap each other..Is there any other way to create a dynamic number of labels into a cell?</p>
  
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "PracLabelCell", for: indexPath) as! PracLabelCell
  
      let w : CGFloat = CGFloat(self.tableview.frame.size.width/3)
      var x : CGFloat = 0
  
      for index in 0...2
      {
          let label = UILabel(frame: CGRect(x: x, y: cell.frame.origin.y, width: w , height: cell.frame.size.height))
          let str = String(index)
          print(str)
          label.text = str
          cell.contentView.addSubview(label)
          print("x is" , x)
          x += w
  
      }
  
      return cell
  }
  </code></pre>