Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect iPad user tap on keyboard hide button?

Tags:

ios

keyboard

ipad

In my app I have some complex logic surrounding the hiding and showing of the keyboard. I am interested in detecting when the user (who has an iPad) specifically taps on the iPad keyboard hide button:

alt text

I am not interested in detecting when the keyboard is supposed to hide, only when the user actually physically taps on this button. Any suggestions?

Thank you!

like image 319
Jason Avatar asked Nov 20 '10 18:11

Jason


1 Answers

I was looking for an exact same solution, and I did found it in the documentation after all. You get a whole package of keyboard notifications:

- UIKeyboardWillShowNotification
- UIKeyboardDidShowNotification
- UIKeyboardWillHideNotification
- UIKeyboardDidHideNotification
- UIKeyboardWillChangeFrameNotification
- UIKeyboardDidChangeFrameNotification

I was interested in "UIKeyboardWillHideNotification". So just implemented:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(KeyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];

Et voilà! Hope this helps, even it's an year late answer.

like image 147
DZenBot Avatar answered Oct 02 '22 15:10

DZenBot