iOS 8 introduced a way for tableViews to automatically adjust their cell\'s height based on their content (via AutoLayout).
// in viewDidLoad:
tableView.rowHeigh
If everything is set up properly (Auto Layout constraints) you do not have to calculate anything yourself.
All you have to do is disable UITextView's scrolling enabled property then on textViewDidChange
call tableView.beginUpdates()
and tableView.endUpdates()
.
For a detailed explanation, check out a post I wrote which also includes a working sample project.