开发者

IPad keyboard "Hide button"

开发者 https://www.devze.com 2023-02-22 22:28 出处:网络
How can I interact with the button\"hide keypad\" In IPad numeric pad. I need to开发者_如何学Go add validation for this button.

How can I interact with the button "hide keypad" In IPad numeric pad. I need to开发者_如何学Go add validation for this button. Or how I can switch off this button?


This is not the delegate method for the keyboard hide button .But I think You can solve this by adding the following code to you .m file

1.Add the following code to your viewWillAppear function

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardDidHideNotification object:nil]; 2.Add the following code to viewWillDisappear function

  [[NSNotificationCenter defaultCenter] removeObserver:self
                                                name:UIKeyboardWillHideNotification
                                              object:nil];

3.Declare function in .h file

     -(void)keyboardWillHide:(NSNotification*)notify;

4.Define function in .m file

-(void)keyboardWillHide :(NSNotification*)notif {

//Add the code for What you wish to do after the key board hide.

}


Use this to get the moment when the user hits that button

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
    [textField resignFirstResponder];
    //your code here
    return YES;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消