Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to resignFirstResponder from view controller

How to resignFirstResponder from uiviewcontroller object with is active.

I have five textfields one,two,three,four,five.

   - (void)removeKeyBoard{
     [one resignFirstResponder];
     [two resignFirstResponder];
     [three resignFirstResponder];
     [four resignFirstResponder];
     [five resignFirstResponder];
    }

The above code has done my job, but each object reference to specify for resignFirstResponder.

Is there any way, that handle the resignFirstResponser which ever field is active on UIViewController automatically resign that object.

@All Thanks in advance.

like image 888
kiran Avatar asked Jan 09 '23 20:01

kiran


1 Answers

Called on whatever view has the textfields in it:

[view endEditing:YES]

UIView reference: Link

like image 82
Louis Tur Avatar answered Jan 18 '23 21:01

Louis Tur