2011-04-06 169 views
2

如何與「隱藏鍵盤」按鈕進行交互 在IPad數字鍵盤中。 我需要爲此按鈕添加驗證。 或者我可以如何關閉此按鈕?IPad鍵盤「隱藏按鈕」

回答

0

使用該得到的那一刻,當用戶點擊該按鈕

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

這不是鍵盤隱藏按鈕。但我認爲,你可以通過添加如下代碼到你解決這個委託方法。米文件

1.增加以下代碼以您的viewWillAppear中功能

[[NSNotificationCenter defaultCenter]的addObserver:自 選擇器:@selector(keyboardWillHide :) 名稱:UIKeyboardDidHideNotification object:nil]; 2.添加以下代碼以viewWillDisappear功能

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

3.Declare函數h文件

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

4.Define在.m文件功能

- (無效)keyboardWillHide: (NSNotification *)notif {

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

}