I have a tableView with static cells inside. One cell contains a map, UITextView
and other controls:
This textview has the following constraints:
So far I set up the heightForRowAtIndexPath
to the static value for this cell:
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
{
if indexPath.row == 0 {
return 311;
}
}
but then when the text is longer, the textview - instead of growing - contains the text inside and user has to scroll it. Basically it is always 311 in height. I want to change it, so that the whole cell adjust to the textView content.
I tried changing return 311
to return UITableViewAutomaticDimension
, but then, when there's no text, the cell shrinks and the controls on the right are not visible.
So my question is - how can I set dynamic height for the cell based on the text inside, but also keep the minimum height of 311?