Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resigning First Responder for multiple UITextFields

There is an application in which I am generating multiple UITextFields dynamically. I want to resign first responder whenever the UITextFields are not selected (touch outside the UITextField). How can I know that of which UITextField I have to resign first responder? Please specify any other way beyond the 'tag' concept because I have tried that. Please suggest the right direction. Thanks in advance.

like image 752
Kritanshu_iDev Avatar asked Jul 14 '11 05:07

Kritanshu_iDev


2 Answers

Don't call resignFirstResponder; call endEditing:!

Call endEditing: on any view above the text fields in the view hierarchy. It will locate the first responder and ask it to resign. Use endEditing:YES to force it or endEditing:NO to let the text field's delegate decide if it should end editing (useful if you are validating input).

like image 195
benzado Avatar answered Nov 03 '22 00:11

benzado


**[self.view endEditing:TRUE];** //Resign firstresponder for all textboxes on the view
like image 24
Nishant Avatar answered Nov 03 '22 00:11

Nishant