0

I have created nested tableView approach, In a view controller I set tableView and then nested tableView for the Cell. So its like Parent tableView and Child tableView.

For adjusting content height tableView row height autoDimension I have created custom class for it and override intrinsicContentSize but I am still getting scrollbar in nested tableview. ContentSize updating but row height not adjusting. I have already set automatic row height for both the parent and child table view.

  • How can I avoid this scrollbar when my content expand it should auto set tableView row height?.

Attaching GitHub code reference and images as well. https://github.com/MasamMahmood/autoHeightTableView

Custom Class Code:

class MyOwnTableView: UITableView {
    override var intrinsicContentSize: CGSize {
        self.layoutIfNeeded()
        print("ContentSizee \(contentSize)")
        return self.contentSize
    }

    override var contentSize: CGSize {
        didSet{
            self.invalidateIntrinsicContentSize()
        }
    }

    override func reloadData() {
        super.reloadData()
        self.invalidateIntrinsicContentSize()
    }
}

Images:

First View Expand View ContentSize

Tekhe
  • 149
  • 1
  • 12
  • I cant see any nested TableView here. Can you please elaborate how there is nested tableView. Can you please share storyboard Views hierarchy image. – Kudos Feb 22 '21 at 13:52
  • @Kudos I have main viewController which contains Parent tableview and then I have created ReviewTableViewCell which contains nested child tableView. I have attached my github link for the code. – Tekhe Feb 22 '21 at 14:00

0 Answers0