У меня есть следующий код, который создает градиентный фон для UITableViewCell. Градиент получился великолепным. Однако, когда я пытаюсь выбрать строку, я не вижу обычной выделенной синим цветом строки. Если я удалю пользовательский код градиента, выделенные строки будут работать нормально. Я не уверен, что мне здесь не хватает. Любая помощь с благодарностью.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"TimeTableViewCellList";
TimeTableViewCell *cell = (TimeTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"TimeCell" owner:self options:nil] lastObject];
//To create the cell gradient
UIColor *startColor = [UIColor whiteColor];
UIColor *endColor = [UIColor colorWithRed:247.0/255.0 green:243.0/255.0 blue:238.0/255.0 alpha:1.0];
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = cell.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[startColor CGColor], (id)[endColor CGColor], nil];
[cell.layer insertSublayer:gradient atIndex:0];
}
TimeEntry * entry = [[self getTimeEntriesBySection:indexPath.section] objectAtIndex:indexPath.row];
//..OTHER CELL VALUES SET HERE
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
return cell;
}