iOS 8 introduced a way for tableViews to automatically adjust their cell\'s height based on their content (via AutoLayout).
// in viewDidLoad:
tableView.rowHeigh
This is the function I use, which solves the problem of the table view bouncing back after every keystroke.
- (void)textViewDidChange:(UITextView *)textView {
CGFloat fixedWidth = textView.frame.size.width;
CGSize oldSize = textView.frame.size;
CGSize newSize = [textView sizeThatFits:CGSizeMake(fixedWidth, MAXFLOAT)];
// Resize cell only when cell's size changes, to prevent bouncing back and forth.
if (oldSize.height != newSize.height) {
[UIView setAnimationsEnabled:NO];
CGRect newFrame = textView.frame;
newFrame.size = CGSizeMake(fmaxf(newSize.width, fixedWidth), newSize.height);
textView.frame = newFrame;
[self.tableView beginUpdates];
[self.tableView endUpdates];
[UIView setAnimationsEnabled:YES];
}
}