I have a UITableView
(let's call it tbl_A) inside a table view cell whose height is dynamic and set by UITableViewAutomaticDimension
. 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 scroll disabled and its frame.size equals its content size. I tried to set tbl_A's frame.size.height = tbl_A.contentSize.height, unfortunately, the height is wrong.
By the way, I don't have to use UITableView
to accomplish this task. I just want to a way to display all data. Any suggestions?
This is the effect I want to achieve:
A view that presents data using rows in a single column. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.1+ tvOS 9.0+
Swift version: 5.6. Index paths describe an item's position inside a table view or collection view, storing both its section and its position inside that section.
Simple ;)
override var intrinsicContentSize: CGSize {
return contentSize
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With