我想辭職鍵盤,而在背景自來水只是還是熬不過在點擊背景時不能辭職鍵盤?
首先我必須點擊編輯文本框和開放的鍵盤,我已cliked另一個文本框不可編輯後,我已經cliked背景,但我水溼辭職鍵盤
這裏是我的代碼
-(void)textFieldDidBeginEditing:(UITextField *)textField
{
if(textField == insertcity)
{
[self.view endEditing:YES];
citytable.hidden = NO;
hoteltable.hidden = YES;
[self SetDynamicHieghtofTbl:citytable andArr:cityarray];
}
if(textField == inserthotel)
{
[self.view endEditing:YES];
hoteltable.hidden = NO;
citytable.hidden = YES;
[self SetDynamicHieghtofTbl:hoteltable andArr:hotelarray];
}
if(self.txt_validationCode.tag == 3)
{
//[self.view endEditing:NO];
}
}
-(void)textFieldDidEndEditing:(UITextField *)textField
{
[textField resignFirstResponder];
if(textField.tag == 3)
{
self.enteredCode = textField.text;
}
}
- (void) backgroundTap: (UITapGestureRecognizer *)recognizer
{
citytable.hidden = YES;
hoteltable.hidden = YES;
[self.txt_validationCode resignFirstResponder];
}
它不起作用 –
請解釋你的代碼,不要只是發佈代碼,希望他們知道這意味着什麼。 – Popeye