Starting with the workaround as suggested by @Andrey Gordeev I extended that to include removing the style layer once the cell is deselected.
I still need to use my custom cell for other reasons, but I have shown it as a standard cell below so anyone can use it
To apply your own style if you have to call
[myTable selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:UITableViewScrollPositionNone];
To add a gradient layer when selecting a cell
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = (UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
CAGradientLayer *gradient = [CAGradientLayer layer];
[gradient setFrame:[cell.contentView bounds]];
[gradient setColors:[NSArray arrayWithObjects:(id)[[UIColor colorWithWhite:0.70 alpha:1.0] CGColor], (id)[[UIColor colorWithWhite:0.50 alpha:1.0] CGColor], nil]];
[[cell.contentView layer] insertSublayer:gradient atIndex:0];
// The next line makes a reference to the gradient layer for selection and removal later on
[[cell.contentView layer] setValue:gradient forKey:@"GradientLayer"];
...
}
To remove the gradient layer when deselecting a cell
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = (UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
// Get the layer using the reference to it
CALayer *gradientLayer = [[cell.contentView layer] valueForKey:@"GradientLayer"];
[gradientLayer removeFromSuperlayer];
[[cell.contentView layer] setValue:nil forKey:@"GradientLayer"];
...
}