Open phoney opened 6 years ago
I'm having the same issue if I set the keyboardDismissMode
to onDrag
or interactive
. After using the specific gesture to dismiss the keyboard, contentInsets are not being restored.
I did not try phoney's workaround
try this. func textFieldDidEndEditing(_ textField: UITextField, reason: UITextFieldDidEndEditingReason) {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1){[weak self] in
self?.scrollView.contentInset = UIEdgeInsetsMake(0.0, 0.0, 0.0, 0.0);
}
}
I have a tableView with Dismiss on Drag set in the storyboard. If I 'drag to dismiss' the bottom contentInset is never restored after the keyboard goes away (and other weird things happen after that).
The keyboardRect in the keyboardWillHide notification always has a height of zero and the code in TPKeyboardAvoiding_keyboardWillHide ignores the notification in that case. If I tap in the tableView or close the keyboard another way things work normally. If I comment out the first four lines in TPKeyboardAvoiding_keyboardWillHide then things work normally even for 'drag to dismiss'
I'm observing this on an iPad on iOS 11.
Is it safe to comment out those four lines?