To set up a custom UITableViewCell using a XIB, you have to do several things:
- Set up an IBOutlet in your header
- Configure the table view cell in Interface Builder
- Load the XIB inside of
tableView:cellForRowAtIndexPath:
- Configure it like any other cell
So... Let's set up an IBOutlet in the header file.
@property (nonatomic, retain) IBOutlet UITableViewCell *dvarTorahCell;
Don't forget to synthesize it inside the implementation file.
@synthesize dvarTorahCell;
Now, let's create and configure the cell. You want to pay attention to the Cell Identifier and the IBOutlet as shown below:

Now in code, you load up the XIB into your cell as shown here:

Notice that the Cell Identifier in Interface Builder matches the one shown in the code below.
Then you go ahead and configure your cell like any other.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"YUOnlineCell" owner:self options:nil];
cell = dvarTorahCell;
dvarTorahCell = nil;
}
//configure your cell here.
Just note that when accessing subviews, such as labels, you now need to refer to them by tag, instead of by property names, such as textLabel
and detailTextLabel
.