-2

I am using table view inside table view I have used some views and then I used cell but when i running in simulator its content not showing properly I added screenshot please check it.

func numberOfSections(in tableView: UITableView) -> Int
{
    return 1
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
    return tc_array.count
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
{
    print(b_description.bounds.size.height)
    return 200 + b_description.bounds.size.height

    // return UITableViewAutomaticDimension
}


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
    let cell : TermCell = tableView.dequeueReusableCell(withIdentifier: "TermCell", for : indexPath as IndexPath) as! TermCell

     cell.tc_lebel.text! = tc_array[indexPath.row]

     print(cell.tc_lebel.text!)

     return cell
}

new image click on it 2: https://i.stack.imgur.com/Lwd8o.png . check it new image

[1]: https://i.stack.imgur.com/I9rYO.png constraint image

1 Answers1

1

If you have placed your constraints correctly, I would suggest removing

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
{

    print(b_description.bounds.size.height)
    return 200 + b_description.bounds.size.height
}

And when you setup your view, in viewDidLoad you should add this for automatic row dimension

 tableView.rowHeight = UITableViewAutomaticDimension
 tableView.estimatedRowHeight = yourAverageCellRowHeight
DionizB
  • 1,487
  • 2
  • 10
  • 20