I'm dynamically sizing a UITextView
's height and the height of the UITableViewCell
it is embedded in when its content changes. But I also have the ability to paste in predefined bits of texts.
As this pasting happens programmatically, the problem is, that after adding the selected text bit to the UITextView
's text and calling my UITableView
to update its cell heights, the UITextView
hasn't yet updated its contentSize, which I use to calculate the cell's height.
Is there a way to force a UITextView to update its contentSize, after I programmatically add text to it?
textView.sizeToFit()
. I'm using this in Swift 2.0 and it works perfectly, just as @Shophar requested, as long as you're using AutoLayout. – Acidulous