Chapter 6. Building the Selfie List UI
With a model object tested and working, it is time to start building up the UI for the app. To start with, we’ll make the UI for showing the list of previously taken selfies.
Creating the Selfie List
As we are using a Master-Detail template, the basic UI has been set up already in the storyboard; we just need to bash it into the shape that we need. The bulk of what we are going to be doing is using the
UITableViewController classes to make our selfie list.
UITableView class is a specialized subclass of
UIView designed to show lists of information. A table view is comprised of one or more sections, and each section has zero or more table view cells. A table view cell can be thought of as just a normal view—it can present anything you want it to.
The data for the table view cells and sections comes from the table view’s
UITableViewDataSource property. Whenever a table view needs to present information, such as how many cells are there in a section or what a single cell should show, it asks its data source for the answer. This means a table view itself has no knowledge of what it is showing or how it is to be structured—that is all handled for it by the data source.
A table view also has a delegate that gets told when non–data related events are occurring, such as when a row has been selected.
Index paths are an important part of table views that get used a great deal by both the data source and the delegate. An index path ...