I have a full-screen UITextView that gets smaller whenever the keyboard appears, so that the keyboard doesn't cover any of the text. As part of this, I also change the textView's bottom contentInset, so the space below the text is smaller when the keyboard is present, and larger when there is no keyboard.
The problem is, whenever the user taps the textView near the bottom to start editing, the bottom contentInset spontaneously resets itself to 32. I know from this answer that it is possible to subclass the UITextView and override the contentInset
method, like this:
@interface BCZeroEdgeTextView : UITextView
@end
@implementation BCZeroEdgeTextView
- (UIEdgeInsets) contentInset
{
return UIEdgeInsetsZero;
}
@end
But this doesn't stop the bottom inset resetting itself - it just changes the figure it resets itself to. How can I make my UITextView just keep to the contentInset value that I have set?