我試圖隱藏具有FormSheet樣式的模式視圖上的iPad鍵盤。我試圖辭去FirstResponder,但沒有任何反應。這是一個錯誤還是根本不工作?隱藏iPad中的ModalView(FormSheet)中的鍵盤
問候
編輯
-(void)hideKeyboards
{
[emailField resignFirstResponder];
[passwordField resignFirstResponder];
[confirmPasswordField resignFirstResponder];
}
-(IBAction)emailFieldDone:(id)sender
{
[self hideKeyboards];
}
-(IBAction)passwordFieldDone:(id)sender
{
[self hideKeyboards];
}
-(IBAction)confirmPasswordFieldDone:(id)sender
{
[self hideKeyboards];
}
你有沒有在.h文件中設置委託? – kb920
這就是我所嘗試的: - (void)hideKeyboards {0FireField resignFirstResponder]; [passwordField resignFirstResponder]; [confirmPasswordField resignFirstResponder]; } - (IBAction)emailFieldDone:(id)sender {[self hideKeyboards]; }(IBAction)passwordFieldDone:(id)sender {[self hideKeyboards]; }(IBAction)confirmPasswordFieldDone:(id)sender {[self hideKeyboards]; } –
檢查你是否將委託設置爲xib中的文本字段或設置textfield.delegate = self; –