Dismissing the keyboard when a button is pressed, programmatically with swift?

后端 未结 4 1490
北恋
北恋 2021-02-15 00:07

How can I dismiss the keyboard when a button is pressed, programmatically with swift?

4条回答
  •  伪装坚强ぢ
    2021-02-15 00:18

    you have to call resignFirstResponder on currently active UI Element (most likely, UITextField).

提交回复
热议问题