how can I dismiss keyboard when I will just touch anywhere except UITextField?

后端 未结 10 2085
独厮守ぢ
独厮守ぢ 2021-02-19 11:12

Hello I have two UITextFields in my application, and want to dismiss the keyboard when I just touch anywhere except the UITextFields how can I do this?

10条回答
  •  旧时难觅i
    2021-02-19 11:44

    Create an invisible button, put it behind the UITextField and send resignFirstResponder message to your text fields when the button is tapped.

提交回复
热议问题