UITableView’s Data Source
The process of providing rows to a UITableView in Cocoa Touch (the collection of frameworks used to build iOS apps) 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 this case, the ItemsViewController is the data source, so it needs a way to store item data.
You are going to use an array to store the Item instances, but with a twist. The array that holds the Item instances will be abstracted into another object – an ItemStore (Figure 9.6).
Figure 9.6 LootLogger object diagram
If an object wants to see all the items, ...
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