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

Introducing NSArrayController

You have already used a table view in SpeakLine. SpeakLine’s use of NSTableView, however, was basic, allowing only simple user interaction. RaiseMan’s table view will be much more dynamic. Rows will be added, edited, removed, and sorted. One way to implement this would be with a table view data source and delegate in the Document class. This is such a common task, however, that Cocoa provides a class for just this purpose: NSArrayController.

NSArrayController, like any controller, serves as the glue between a view and its model, an array of objects. In SpeakLine, the window controller was the table view data source and delegate, supplying data to the view and reacting to selection changes. NSArrayController ...

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