7

Hi is there any way to detect iPad keyboard hiding button ? i mean when user press this button :

alt text

something going to happen !

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
Mc.Lover
  • 4,813
  • 9
  • 46
  • 80

4 Answers4

17

I'm not sure what you want to accomplish, but maybe this can help you: Register with NSNotificationCenter to receive the 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.");
}
DarkDust
  • 90,870
  • 19
  • 190
  • 224
  • thaaaaank you works great but instead of UIKeyboardWillHideNotification i use will show ... works great for me – Mc.Lover Aug 20 '10 at 16:46
0

put this to 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 - (BOOL)textFieldShouldReturn:(UITextField *)textField; delegate method to get called when keyboard down button is pressed in iPAD.

Vaibhav Saran
  • 12,848
  • 3
  • 65
  • 75
0

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

This actually crashes on the go.

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

Then it will work just fine.. :-)

Waleed Mahmood
  • 1,356
  • 12
  • 13
0

with Javascript

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

It fires when you have your keyboard open and when you close your "keyboard". It doesn't fire when you select another text field or button, because it targets on null. If you use in combination with keydown, you can save multiple value and call your submit function only when you release your keyboard.

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