I am trying to implement a UITextView in a table cell at the bottom of a table.
I tried the suggestions here. Performing a UITableView scroll when selecting a text field and other solutions, but they are a bit different, because I have to artificially add extra height to the current view, to create space for the keyboard.
Here is what I added to the previous solution to transfer it to my application.
-(void) keyboardWillShow:(NSNotification *)note { CGRect frame = self.view.frame; frame.size.height += keyboardHeight; frame.origin.y -= keyboardHeight; self.view.frame = frame; } -(void) keyboardWillHide:(NSNotification *)note { CGRect frame = self.view.frame; frame.size.height -= keyboardHeight; frame.origin.y += keyboardHeight; }
Doing this will correctly add height to the view and scroll to the cell, but after restoring the original viewing height, scrolling outside the current visible view becomes impossible even if there is valid content outside the borders (I see the text before the scroll bar bounces back).
If I try to save the frame or table frames (not the view) in keyboardWillShow and restore them to keyboardWillHide, the scroll will be restored, but the view will be cut in half.
Are there any means to this other than hard coding for extra height at the bottom of the view?
source share