Lothar
Lothar

Reputation: 13079

Cocoa NSVIew notification when the view gets the key focus?

How can i get a notification if a NSView gets the key focus?

I expected a method like "windowDidBecomeKey" from NSWindow but either i'm blind or there is nothing like this is NSView.

Upvotes: 4

Views: 4621

Answers (1)

Peter Hosey
Peter Hosey

Reputation: 96353

The key view, when there is one, is the first responder. So, implement the becomeFirstResponder method in your view, and either handle that there or post a notification for your controller to listen for.

Upvotes: 7

Related Questions