Skip to Content
Cocoa Programming for OS X: The Big Nerd Ranch Guide
book

Cocoa Programming for OS X: The Big Nerd Ranch Guide

by Aaron Hillegass, Adam Preble, Nate Chandler
April 2015
Intermediate to advanced
556 pages
17h 47m
English
Big Nerd Ranch Guides
Content preview from Cocoa Programming for OS X: The Big Nerd Ranch Guide

19 Keyboard Events

When the user types, where are the corresponding events sent? First, the window manager gets the event and forwards it to the active application. The active application forwards the keyboard events to the key window. (This window is what most users call the “active window,” but Cocoa developers call it the key window because it receives keyboard events.) The key window forwards the events to the active view.

Which view is the active one? Each window has an outlet called firstResponder that points to one view of that window. That view is the active view for that window. For example, when you click on a text field, it becomes the firstResponder of that window (Figure 19.1).

Figure 19.1  The first responder ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Cocoa with Objective-C, 4th Edition

Learning Cocoa with Objective-C, 4th Edition

Paris Buttfield-Addison, Jonathon Manning, Tim Nugent
Objective-C for Absolute Beginners: iPhone, iPad and Mac Programming Made Easy

Objective-C for Absolute Beginners: iPhone, iPad and Mac Programming Made Easy

Stefan Kaczmarek, Brad Lees, Gary Bennett, Mitch Fisher

Publisher Resources

ISBN: 9780134077130Purchase book