O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required