Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12231

How to add keyboard shortcut for bar buttons

$
0
0

I have an iOS/iPad/Macos(Catalyst) app.

There is a toolbar configured as follows:

navigationItem.rightBarButtonItems = [    UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(runSomeCode)),    UIBarButtonItem(image: myImage, style: .plain, target: self, action: #selector(saveMyWork)),    ...]

I want to add keyboard shortcuts. For example Cmd+'a' to perform runSomeCode. And Cmd +'I' to perform saveMyWork. The main target is Macos(catalyst) app.

How shall I assign these shortcuts to bar buttons?


Viewing all articles
Browse latest Browse all 12231

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>