I have filled my view with ScrollView (same size as the view) and I'm stuck at how to resign first responder when user tap elsewhere in the View (or the scrollview). Any idea on how to do that ? I'm using the following method but it's not working as expected:
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
Thx for helping,
Stephane
I found the answer here:
If your ultimate aim is just to resign the first responder, this should work:
[self.view endEditing:YES]
The endEditing(_:)
method is designed right for it
Causes the view (or one of its embedded text fields) to resign the first responder status.