I have a UIViewCOntroller
that contains a UITextView
. When the keyboard appears I resize it like this:
#pragma mark - Responding to
A lot of answers already, I found that in my case it's actually much simpler. On keyboardWillShow I adjust the text view's contentInset
and keep the frame full screen. And while scrollRangeToVisible:
is not working for me like for so many others, the scroll view methods (from which UITextView inherits) work just fine. This works for me:
- (void)textViewDidChange:(UITextView *)textView
{
CGRect caret = [_textView caretRectForPosition:_textView.selectedTextRange.end];
[_textView scrollRectToVisible:caret animated:YES];
}