Cocoa NSVIew notification when presentation gets key focus?

How can I get a notification if NSView receives key focus?

I was expecting a method like "windowDidBecomeKey" from NSWindow, but either I'm blind or there is nothing like NSView.

+3
source share
1 answer

The key view, when it is, is the first responder. So, implement the methodbecomeFirstResponder in your view and either process it there, or send a notification to your controller to listen.

+7
source

Source: https://habr.com/ru/post/1757103/


All Articles