Graphics Programs Reference
In-Depth Information
Double-check that
HomepwnerItemCell.h
looks like this:
@interface HomepwnerItemCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *thumbnailView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *serialNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *valueLabel;
@end
You can also see in
HomepwnerItemCell.m
that making a property outlet connection
automatically adds a
@synthesize
statement for the property.
Finally, note that you did not specify the
File's Owner
class or make any connections with
it. In the case of
UITableViewCell
XIBs, the
File's Owner
is not used.
Using HomepwnerItemCell
In
ItemsViewController
's
tableView:cellForRowAtIndexPath:
method,
you will create an instance of
HomepwnerItemCell
for every row in the table. At the
top of
ItemsViewController.h
, import the header file for
HomepwnerItemCell
so that
ItemsViewController
knows about it.
#import "HomepwnerItemCell.h"
In earlier implementations of
tableView:cellForRowAtIndexPath:
, you would
ask the table view if it had any reusable cells first and create a brand new one if it did not.
When using a XIB file to load a
UITableViewCell
subclass, the process is a little dif-
ferent: you register this XIB file with the
UITableView
for a given reuse identifier
when the table first loads.
In
ItemsViewController.m
, override
viewDidLoad
to register
Homepwner-
ItemCell.xib
for the
HomepwnerItemCell
reuse identifier.