I have a UIViewCOntrollerthat contains a UITextView. When the keyboard appears I resize it like this:
#pragma mark - Responding to
Angel Naydenov's comment above is right, especially in cases such as switching from English to Japanese keyboard that shows suggests.
When switching keyboards, UIKeyboardWillShowNotification is called but UIKeyboardWillHideNotification is not called.
So you must adjust the inset to use the absolute value and not use +=.
Unrelatedly, [self.textView setContentOffset:newOffset animated:YES]; will not actually change the graphics in iOS 7.1 after the keyboard is shown for the second time, which is probably a bug. A workaround I used is replacing
[self.textView setContentOffset:newOffset animated:YES];
with
[UIView animateWithDuration:.25 animations:^{
self.textView.contentOffset = newOffset;
}];