Shortcut iPad for a button?

Hey there,


since there are keyboards for the ipad it makes sense to use shortcuts in your application e.g. for a specific button.


In a macOS App I can simply set one in the interface builder but with an iPad iOS app it seems not to be possible that way...


Do you know how to add a shortcut to a button (e.g. the button's action should be executed if you press the "return" key on your iPad external keyboard) ?


Help would be very welcome!


Thanks a lot!

Accepted Reply

I solved it now with using a Primary Action Trigger

Replies

If that's only for return key, this should make it:

use the

textFieldShouldReturn
delegate method to detect when the return/enter button is pressed on the keyboard.


https://stackoverflow.com/questions/34799140/how-do-i-set-a-key-equivalent-on-a-uibutton-in-swift-2-xcode-7/34801313#34801313

Thanks, but how do I use it?


if I use:

self.textFieldShouldReturn(self.Input)

in a timer it always "jumps accross" the return key. So without that I tapped on "return". It is executed as soon as I call it.

But if I call it I don't want to execute it - I want it to check if the user is tapping on "return".


Or do I must use it otherwise?

I solved it now with using a Primary Action Trigger

Thanks for feedback.


Funnu enough I had this question and solution a few years ago…

https://forums.developer.apple.com/thread/103127

Yeah, that's funny.


It's great that you help here in the Community!