Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
The Key View Loop
The key view loop is a sequence of first responder-accepting views in each window. When the user cycles focus between views with Tab or Shift-Tab, the key view loop is behind it. Cocoa automatically computes a key view loop based on view positioning, but it is possible to change it by setting the nextKeyView outlet on your views, as well as initialFirstResponder.
Unfortunately your users cannot take advantage of the key view loop in Dice, because DieView ignores the tab key events. Fixing this is simple enough. interpretKeyEvents(_:) calls insertTab(_:) and insertBacktab(_:) if they are present. Add them now in the Keyboard Events section of DieView. They will simply ask the window to handle selecting the next ...
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.
Read now
Unlock full access