The iPad virtual keyboard will disappear in one of (at least) these 3 circumstances:
- If the control (say, a UITextField) programmatically resigns first responder.
- If the user taps the "dismiss keyboard" button in the lower right.
- If the user connects to the USB/keyboard dock peripheral.
In all cases, I get the UIKeyboardWillHideNotification
.
The problem is that the first two cases are generally equivalent-- in other words, the user is done editing the text field. But in the third case, the text field is still being edited, just from another input source.
The problem is detecting the difference between cases 2 and 3. All I get in both cases is UIKeyboardWillHideNotification
. In case 2, I generally want to also lock the edit control and commit the value. In case 3, I generally want to do nothing and allow editing to continue.
But how can I tell the difference?
Apple's Pages app seems to be able to distinguish this on document-title renaming.