Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I want to assign a key equivalent to an NSButton if the control is the first responder.
NSButton
你可以在你的实现中覆盖becomeFirstResponder:和调用setKeyEquivalent:。如果要在按钮失去第一响应者状态时删除等效键,请覆盖resignFirstResponder:.
becomeFirstResponder:
setKeyEquivalent:
resignFirstResponder: