durgesh pandey
durgesh pandey

Reputation: 1

TableView with dynmic cells inside a TableViewCell with dynamic height

I want to implement subTableView with dynamic height inside the UITableViewCell, where as the subTableView has cells with dynamic UITableViewCell. Please share your thoughts on this if anybody have implemented this scenario.

-UItableview(Parent)
  -UItableviewCell
     -UITableView(child)
        -UItableviewCell(dynamic content).

I tried this approach, it works but only after scroll and not on the first load. How i can solve this problem? https://stackoverflow.com/a/57995132

Upvotes: 0

Views: 38

Answers (1)

Umar Muzaffer
Umar Muzaffer

Reputation: 36

Approach: For storyboard, here is the approach to increase the parent tableView height according to child tableview's content size.

  1. Create a height constraint with any value for child tableView and conect an IBOutlet that sets the child tableView height.
  2. Set the height constraint's constant to tableView.contentSize.height

self.parentTableViewHeight.constant = self.childTableView.contentSize.height

Upvotes: 0

Related Questions