I want my program to press certain keys on my keyboard without me doing it physically. for example, button in my app for (command + UP) if user press the button, my开发者_Python百科 app will do same thing in the keyboard . How i do this?
I'm assuming that you have a function that will be triggered when the user presses the command + up keys. So to illustrate:
command + up ---> call function
And you are asking is there a way to:
click a button ---> somehow trigger command + up event ---> call function
But why not you just do:
click a button ---> call function
Much simpler and more straight-forward. Is there any specific reason you still need the command + up event triggered?
I am assuming it is that you have linked a menu item to an IBAction IN Interface Builder and given it a short cut of command+ up. If so just link your button to the same action
edit* Have a look at these.
Xcode 4 xcode_help-interface_builder help including video examples
xcode 3 - Interface Builder User Guide pdf look at chapter 7. ( I could not find the guide on apples site, it all points to v4?)
精彩评论