How to detect if keyboard is oppen/closed?

Hi,
So im using a textfield and when its clicked on a keyboard appers, but how can i check if the keyboard is oppen or closed?

I would really appreciate some help

What do you mean by “if the keyboard is open or closed”?

When the user clicks on the textfield the keyboard appears(its now open) and when the user clicks on “cancel” its closed(not visible)

Perhaps I should have asked what do you mean by “check if the keyboard is open or closed”? Do you mean programatically? I know that it’s pretty obvious that the keyboard visibly appears when the user taps on the TextField.

It’s still not clear what you are trying to do.

While I agree with Chris, I’m confused what you’re asking for exactly.

You use notifications to know the position of the keyboard, shown here.

There’s these events that you can be notified programmatically about.

  • UIKeyboardWillShowNotification
  • UIKeyboardDidShowNotification
  • UIKeyboardWillHideNotification
  • UIKeyboardDidHideNotification