You should set the table view's delegate and respond to tableView:willDisplayCell:forRowAtIndexPath:
.
- (void)viewDidLoad {
[super viewDidLoad];
self.tableView = self.contentView.subviews[0]; // use a property UITableView *tableView
self.tableView.delegate = self;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView != self.tableView) return;
cell.backgroundColor = [UIColor clearColor];
}
This will work for both static and dynamic table views.