Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
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 ...
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