IPad Keyboard Detection Hide Button

Hi, is there a way to detect iPad keyboard hiding? I mean when the user clicks this button:

alt text

something will happen!

+7
ipad
source share
4 answers

I'm not sure what you want to achieve, but maybe it can help you: Register with NSNotificationCenter to get UIKeyboardWillHideNotification and / or UIKeyboardDidHideNotification.

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myKeyboardWillHideHandler:) name:UIKeyboardWillHideNotification object:nil]; ... - (void) myKeyboardWillHideHandler:(NSNotification *)notification { NSLog(@"Keyboard wants to hide. What a coward."); } 
+17
source share

put this on viewDidLoad

 // register to track event when user presses hide keyboard button on bottom right cornor for iPAD [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldShouldReturn:) name:UIKeyboardWillHideNotification object:nil]; 

and this will make your delegate method - (BOOL)textFieldShouldReturn:(UITextField *)textField; to call when the keyboard key is pressed in the iPAD.

0
source share

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

It really is a glitch on the go.

But if you call a custom method, for example: [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector (myCustomeMethodToResignTextFieldResponder): UIKeyboardWillHideNotification object: nil];

Then it will work fine ... :-)

0
source share

with javascript

I found a desktop for IOS7 iPad. I will test on iOS8 to make sure it works. So basically I create a listener in every FOCUSOUT event (for all my texts), and I call my function.

It fires when you open the keyboard and close the "keyboard." It does not fire when you select another text field or button, because it is aimed at zero. If you use in combination with keydown, you can save several values ​​and call the send function only when you release the keyboard.

 document.addEventListener('focusout', function(e) { if (e.relatedTarget == null){ alert("close keyboard without click on something else"); callYourFunction(); } }); 
0
source share

All Articles