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

后端 未结 10 2055
独厮守ぢ
独厮守ぢ 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条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-19 11:32

    Keep a reference to the UITextField in your view controller and call [yourTextField resignFirstResponder]

提交回复
热议问题