Hassy
Hassy

Reputation: 5208

dismiss Keyboard not working

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?

Upvotes: 1

Views: 973

Answers (1)

santhu
santhu

Reputation: 4792

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

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

Upvotes: 2

Related Questions