I am trying to resign keyboard while tap on background but I cann't
first I have clicked on editable textfield and open keyboard then I have cliked on another textfield that is not editable after that I have cliked background but I cann't resign keyboard
here is my code
-(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];
}
Tarun Kumar
22-Jul-2015try this or remove the tap gesture and add the following method