How to make UITableView fit to content's size
<p>I have a <code>UITableView</code> (let's call it tbl_A) inside a table view cell whose height is dynamic and set by <code>UITableViewAutomaticDimension</code>. tbl_A's cell height is also dynamic, and I know tbl_A's data won't be too much. So I want tbl_A to be <strong>scroll disabled</strong> and its <strong>frame.size equals its content size</strong>. I tried to set tbl_A's frame.size.height = tbl_A.contentSize.height, unfortunately, the height is wrong.</p>

<p>By the way, I don't have to use <code>UITableView</code> to accomplish this task. I just want to a way to display all data. Any suggestions?</p>

<p><strong>This is the effect I want to achieve:</strong>
<a href="https://i.stack.imgur.com/4hhO4.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/4hhO4.jpg" alt="enter image description here"></a></p>