UITableView’s Data Source
The process of providing a UITableView with rows in Cocoa Touch is different from the typical procedural programming task. In a procedural design, you tell the table view what it should display. In Cocoa Touch, the table view asks another object – its dataSource – what it should display. In our case, the ItemsViewController is the data source, so it needs a way to store possession data.
In Chapter 2, you used an NSMutableArray to store Possession instances. You will do the same thing in this exercise, but with a little twist. The NSMutableArray that holds the Possession instances will be abstracted into a PossessionStore (Figure 10.5).
Figure 10.5 Homepwner object diagram
PossessionStore: a singleton
If an object wants ...
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