TPKeyboardAvoiding icon indicating copy to clipboard operation
TPKeyboardAvoiding copied to clipboard

Text frame "jumps" on resignFirstResponder when not using UIReturnKeyDefault

Open rholstad opened this issue 3 years ago • 0 comments

This can be observed using the provided sample application and making the following changes to TPKAScrollViewController

  • Modify the returnKeyType and set the delegate for each UITextField
textField.returnKeyType = UIReturnKeyDone;
textField.delegate = self;
  • Implement -(BOOL)textFieldShouldReturn:(UITextField *)textField to dismiss keyboard
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return true;
}

Type in any field and click the Done button. The _UITextContentView frame jumps to the left briefly before returning to its original position. ezgif com-gif-maker

This was introduced in build 1.2.4 by adding [self layoutIfNeeded] to -TPKeyboardAvoiding_keyboardWillShow: in commit f533c6c. I see that the issue this was intended to address was "Scrollview stuttering problem on content inset/offset change fixed." Removing this code fixes the text jumping when resigning first responder status, but what are the ramifications?

rholstad avatar Apr 14 '21 21:04 rholstad