detect iPad keyboard Hiding button

前端 未结 2 1378
小鲜肉
小鲜肉 2020-12-18 02:35

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

\"alt

相关标签:
2条回答
  • 2020-12-18 03:16

    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.");
    }
    
    0 讨论(0)
  • 2020-12-18 03:29

    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.

    0 讨论(0)
提交回复
热议问题