I have a UITableViewController that contains a custom cell. Each cell was created with a pen and contains one non-scrollable UITextView. I have added restrictions within each cell so that the cell adapts its height to the contents of the UITextView. So, initially my controller looks like this:

Now I want that when the user enters something into the cell, its contents automatically adapt. This question has been asked many times, see, In particular, this or the second answer here . So I wrote the following delegate in my code:
- (BOOL) textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)text { [self.tableView beginUpdates]; [self.tableView endUpdates]; return YES; }
However, this leads to the following strange behavior: all restrictions are ignored, and the height of all cells is reduced to the minimum value. See the picture below:

If I scroll down and up the tableView to initiate a new call to cellForRowAtIndexPath, I restore the correct heights for the cells:

Note that I have not implemented heightForRowAtIndexPath, since I expect autoLayout to take care of this.
Can someone tell me what I did wrong or help me here? Thank you very much !
source share