O'Reilly logo

Learning Cocoa by Apple Computer Inc

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

Chapter 9. Data Functionality

This chapter uses a simple tutorial application called Expenses to introduce two of Cocoa’s data handling features that are used in many types of applications. You need to be familiar with these features to complete the advanced tutorials in Chapter 11, Chapter 12, and Chapter 13.

The first section of the chapter covers table views—user interface objects that display data as rows and columns. Implementing a table view will deepen your understanding of the interaction between controls, cells, and their enclosing objects. Your work with table views will also provide an introduction to the concept of data sources—helper objects that provide the data to a table view for display.

In the final section of this chapter, you’ll use Cocoa’s archive/unarchive mechanism to “flatten” a group of data objects (also known in object-oriented parlance as serialization) so they can be saved to persistent storage and later retrieved for use.

Table Views and Data Sources

Table views are objects that display data as rows and columns. In a table view, a row typically maps to one object in your data model, while a column maps to an attribute of the object for that row. Some columns may hold derived or calculated values. Often, only a subset of an object’s attributes appear in the table view. See Figure 9.1

Mapping a data model to a table view’s rows and columns

Figure 9-1. Mapping a data model to a table view’s rows and columns ...

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