简体   繁体   中英

Perform keyboard shortcut programmatically - Objective-C

I'm searching for a way to programmatically perform a keyboard shortcut, just as if the user had clicked the keys himself. That shortcut, however, is chosen by the user with a custom control called ShortcutRecorder .

Is there any way to take the info given by ShortcutRecorder (basically the key code and the flags, I think) and perform that shortcut?

您可以使用CGEventPost()在系统范围内发布键盘事件,但是用户将必须在“通用访问系统偏好设置”窗格中启用对辅助设备的访问。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM