So, usually with an iPhone table you should just use one of the built-in styles: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/instp / UITableView / separatorStyle
As an iPhone developer who has been along this path, I suggest you avoid images where possible and use the API to build your application.
If you insist on your reckless course or you have a client demanding this or something else, then what you can do is subclass UITableViewCell.
In your UITableViewCell subclass, you can add all the user interface elements that you want in the contentView of the cell, including the separator image at the bottom of the cell.
So, here is an implementation of a delegate function that returns a table cell using a custom UITableViewCell:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell";
And here is my simplified implementation of SavedTableCell.h:
And here is the simplified SavedTableCell.m:
Andrew Johnson Feb 09 '10 at 7:25 2010-02-09 07:25
source share