I made an app switching to full screen mode. I want to use ESC key to escaping fullscreen mode, but binding menu item to ESC key in IB is removed at runtime. How can I keep ESC key binding to a menu item?
Avoiding the Esc key If you have an American English keyboard, pressing Ctrl-[ (control plus left square bracket) is equivalent to pressing Esc.
True to its name, the Esc key acts like a “Cancel” button on most computers. On Windows, for example, the key can be used to close a dialog box without having to click “Cancel” with a mouse button. You can also use the Esc key to cancel loading a website in a browser.
On computer keyboards, the Esc key Esc (named Escape key in the international standard series ISO/IEC 9995) is a key used to generate the escape character (which can be represented as ASCII code 27 in decimal, Unicode U+001B, or Ctrl + [ ).
Preferred way to handle escape key in Cocoa is this as like @Josh Caswell said.
#pragma mark - NSResponder - (void)cancelOperation:(id)sender { [self exitFullScreen]; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With