Context:
I\'m creating one of my first apps but I\'ve ran into an issue I cannot figure out.
I have tableView w
textView
is attached directly to the top and bottom of the contentView
or to views which are connected to the top and bottom of the contentView
, so that autolayout can make out the height by connecting the constraints.textView
and disable scrolling. Let automatic dimension take care of all that. tableView.beginUpdates()
and tableView.endUpdates()
on textViewDidChange
Here is my repo which demonstrates the same.
OP Edit:
You should store the additional height that you add in a variable in the cell class so the cells can reload an appropriate height when the tableVIew is reloaded.
You should also change textViewDidChange method
cell.frame = CGRect(x: cell.frame.origin.x, y: cell.frame.origin.y, width: cell.frame.width, height: textView.frame.height)
to
let newFrame = ”originalCellHeight” - ”originalTextViewHeight” + textView.contentSize.height
cell.frame = CGRect(x: cell.frame.origin.x, y: cell.frame.origin.y, width: cell.frame.width, height: newFrame )`