How do I get the return key to perform the same action as a button press in Swift?

前端 未结 5 2008
一向
一向 2020-12-12 23:42

I want to know how you allow an action to be made by either pressing the return key on the software keyboard or by tapping a UIButton.

The UI button is already set u

5条回答
  •  难免孤独
    2020-12-13 00:00

    If your deployment target is iOS 9.0 or later, you can connect the “Primary Action Triggered” event of your text field to an action, like this:

    I was not able to get the "Primary Action Triggered" to work as suggested. I used "Editing Did End" and that works for now Screenshot of Editing Did End

提交回复
热议问题