How to detect if keyboard is present or not?

i want to detect whether keyboard is present on screen or not....

Tagged:

Answers

  • adamkempadamkemp USInsider, Developer Group Leader mod

    What do you mean by that exactly? Do you mean detect a hardware keyboard or detect when the software keyboard is visible?

  • hardik.1768hardik.1768 USMember

    i'm talking about software keyboard which shows on device screen i have view controller in my storyboard....now in ipad i view it in portrait mode then i press on textfield then keyboard is visible now when i set it to landscape left or right then on viewdid layout subview i want to detect whether keyboard is visible or not on the screen...

  • adamkempadamkemp USInsider, Developer Group Leader mod

    See here.

  • hardik.1768hardik.1768 USMember

    still din't get my ans...can u please help me...

  • adamkempadamkemp USInsider, Developer Group Leader mod

    Use the UIKeyboard.Notifications.ObserveWillShow method to detect when the keyboard is shown and the UIKeyboard.Notifications.ObserveWillHide method to detect when the keyboard is hidden. One thing to be aware of is that you may get multiple calls to the "will show" callback before getting a "will hide" callback. They are not guaranteed to be balanced. Basically, any time the software keyboard changes size you'll get a "will show" notification to let you know the new size. Also keep in mind that the framework only considers the software keyboard to be "showing" (as far as the notifications go) when it is docked. A floating keyboard (merged or not) will not invoke those callbacks. The reasoning is that these notifications are used to move things out of the way of the keyboard, but if the keyboard is undocked then the user can move the keyboard instead. Your app shouldn't try to move out of the way of an undocked keyboard.

  • AndreAguiarAndreAguiar USMember ✭✭

    I need check if keyboard is visible when button is clicked, i can do that? how?

Sign In or Register to comment.