How to resign first responder from text field when user tap elsewhere?

前端 未结 18 3146
野趣味
野趣味 2020-12-14 02:12

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 id

18条回答
  •  别那么骄傲
    2020-12-14 02:25

    For my implementation, [self.view endEditing:YES] did not work.

    To finally make sure the keyboard was hidden, I had to make one of my views the first responder, and then immediately make it resign as per the function below:

    -(void) hideKeyboardPlease{
       [uiTextTo becomeFirstResponder];
       [uiTextTo resignFirstResponder];
    }
    

提交回复
热议问题