1
votes

Hi, I am not able to dismiss keyboard. I have a scroll view which have UITextFields on a it. I tried using

[self.view endEditing:YES];

And

[self.scrollView endEditing:YES];

I tried using resignFirstResponder on individual textfields but no use.

This issue only occurs when I tap a textfield which I am using as button when taped upon it I use

[textField resignFirstResponder];

but old one don't resign whatever I do like I tried using endEditing before I resigned the button like textfield. So my question is what could be the problem in my scenario and is there any way to forcefully dismiss keyboard?

1
For resignFirstResponder.. have you set the delegate for your textfield? - GenieWanted
What triggers the method that calls [textField resignFirstResponder];? - trojanfoe
- (void)textFieldDidBeginEditing:(UITextField *)textField triggers the method to resign keyboard - Hassy

1 Answers

2
votes

If you want textField to act as button, use delegates.

textField.delegate=self;
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
   return NO;
}