Graphics Programs Reference
In-Depth Information
Finally, click on the cell in the outline view and select the identity inspector. Change the
Class to HomepwnerItemCell ( Figure 15.6 ).
Exposing the properties of HomepwnerItemCell
This cell looks nice, and it is almost ready to use in Homepwner , but there is one problem.
When an instance of HomepwnerItemCell is created in
tableView:cellForRowAtIndexPath: , you will need to set the text of each of
these labels and the image of the UIImageView . (A cell that you can't configure
would be pretty useless.) Thus, HomepwnerItemCell needs properties to access each
of the subviews that makes up its interface.
The next step, then, is to create and connect outlets on HomepwnerItemCell for each
of its subviews. You will use the same technique you have been using the last few
chapters of Control-dragging into the source file to create the outlets. However, there will
be a small difference for HomepwnerItemCell 's outlets: they will be properties in-
stead of simply instance variables.
In DetailViewController , none of the outlets to the UITextField s were ex-
posed as properties because no other object was supposed to have access to them. In this
case, the table view's data source must configure each subview. By exposing the subviews
as properties, the data source ( ItemsViewController ) will have the access it needs
to do this.
Option-click on HomepwnerItemCell.h while HomepwnerItemCell.xib is
open. Control-drag from each subview to the method declaration area in Homepwner-
ItemCell.h . (If there is an instance variable area defined in your file, you want to drag
to the area after the closing bracket.) Name each outlet and configure the other attributes
of the connection, as shown in Figure 15.7 . (Pay attention to the Connection , Storage , and
Object fields.)
Figure 15.7 HomepwnerItemCell connections
 
Search WWH ::




Custom Search