Allen Savio
Allen Savio

Reputation: 151

Resizing a cell which contains a tableview with dynamic content in it

I have a Tableview inside a Table View cell. The Tableview has a accordian view that can expand or collapse. How to resize the cell to the tableview height which changes dynamically?

Upvotes: 1

Views: 50

Answers (1)

Gottelicious
Gottelicious

Reputation: 48

I would use a delegate.

Create a protocol that your outer table view controller conforms to:

func cellHeightChanged(newHeight: CGFloat) {
  self.cellHeight = newHeight
  self.tableView.reloadData()
}

Then give the inner table view a reference to the outer controller and call this method whenever the height changes.

Upvotes: 1

Related Questions