In my story board I have a UITableView
with dynamically generated UITableViewCell
s. Each cell contains 2 labels and 1 text view:
I
The key to getting self-sizing table cells (autolayout-based, which I recommend) is as follows:
contentView
of the UITableViewCell
contentView
such that your subviews reach all edges of the table cell. In your case, this probably means aligning the leading
, trailing
, top
, and bottom
edges of your UITextView
to the corresponding edges of the contentView
.UITableViewAutomaticDimension
instead of a hardcoded CGFloat
.tableView.estimatedRowHeight = x
(a hard coded constant is fine, this is for performance).