I need to check the condition of keyboard visibility in my iOS app.
Pseudocode:
if(keyboardIsPresentOnWindow) {
//Do action 1
}
else if (keyboardIsNotPresentOnWindow) {
//Do action 2
}
How can I check this condition?
…or take the easy way:
When you enter a textField, it becomes first responder and the keyboard appears.
You can check the status of the keyboard with [myTextField isFirstResponder]
. If it returns YES
, then the the keyboard is active.