TPKeyboardAvoiding icon indicating copy to clipboard operation
TPKeyboardAvoiding copied to clipboard

Dismiss on Drag causes problems

Open phoney opened this issue 6 years ago • 2 comments

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?

phoney avatar May 15 '18 21:05 phoney

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

fl034 avatar Aug 27 '18 11:08 fl034

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);
    }
}

AzamRahmat avatar May 13 '19 09:05 AzamRahmat