4

How can I find the UIKeyboard is open in my application or not?

I don't want to use any delegate methods of UITextField.

Please suggest any solution.

Thanks in advance.

iPatel
  • 46,010
  • 16
  • 115
  • 137
Sunil Targe
  • 7,251
  • 5
  • 49
  • 80
  • Please refer to the answer of [How to programatically check whether a keyboard is present in iphone app?](http://stackoverflow.com/questions/1490573/how-to-programatically-check-whether-a-keyboard-is-present-in-iphone-app) – Maen Mar 05 '13 at 08:42

2 Answers2

5

Test this :

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
VivienCormier
  • 1,133
  • 1
  • 11
  • 16
4

From official Documentation.

Use keyboard notification for check status of UIKeyBoard.

Keyboard Notifications:

When the system shows or hides the keyboard, it posts several keyboard notifications. These notifications contain information about the keyboard, including its size, which you can use for calculations that involve moving views. Registering for these notifications is the only way to get some types of information about the keyboard. The system delivers the following notifications for keyboard-related events:

UIKeyboardWillShowNotification
UIKeyboardDidShowNotification
UIKeyboardWillHideNotification
UIKeyboardDidHideNotification
iPatel
  • 46,010
  • 16
  • 115
  • 137