aashish nagar
aashish nagar

Reputation: 59

UITableView within UITableViewCell with AutoDimension

I want to implement a UITableview inside a UITableViewCell. Only condition is I need to use UITableViewAutomatic Dimension for both table. Giving a fix height works fine, but I have no idea how to implement with UITableViewAutomatic dimension.

Upvotes: 0

Views: 200

Answers (1)

Shehata Gamal
Shehata Gamal

Reputation: 100541

You need 2 steps

1- In viewDidLoad

tableView.estimatedRowHeight = 120 // initial height to help auto-layout such as current cell height in xib  
tableView.rowHeight = UITableViewAutomaticDimension

2- Create your cell constrained properly from top to bottom so auto-layout can infer it's real height in run-time

Also check this tutorial

Upvotes: 1

Related Questions