I have an SCSelectionCell having the title "Choose A Color." When the user taps that cell, I want to be able to have all of the cells of the detail view be different colors. Right now, I'm just using an array for the cell's items.
I've tried using both detailCell.backgroundColor and detailCell.contentView.backgroundColor with no success.
Here is a snip from my viewDidLoad to set up the STV:
[_tableView setBackgroundColor:[UIColor clearColor]];
_tableViewModel = [[SCTableViewModel alloc] initWithTableView:_tableView withViewController:self];
// Color Selection Cell
SCSelectionCell *colorCell = [SCSelectionCell cellWithText:@"Choose A Color"];
colorCell.items = [NSArray arrayWithObjects:@"Red", @"Blue", nil];
colorCell.allowMultipleSelection = NO;
colorCell.detailTableViewStyle = UITableViewStyleGrouped;
colorCell.selectionStyle = UITableViewCellSelectionStyleGray;
colorCell.autoDismissDetailView = YES;
colorCell.delegate = self;
// Create Color section
SCTableViewSection *colorSection = [SCTableViewSection sectionWithHeaderTitle:nil];
// Add cells to section
[colorSection addCell:colorCell];
// Add section to the tableview model
[_tableViewModel addSection:colorSection]
And here is where I'm catching the detail view and trying to change the cells' colors
- (void)detailViewWillAppearForCell:(SCTableViewCell *) cell withDetailTableViewModel:(SCTableViewModel *) detailTableViewModel
{
detailTableViewModel.viewController.navigationController.navigationBar.tintColor = [UIColor blackColor];
SCTableViewSection *detailSection = [detailTableViewModel sectionAtIndex:0];
// Change color of Red cell
SCTableViewCell *detailCell = [detailSection cellAtIndex:0];
detailCell.backgroundColor = [UIColor redColor];
// Change color of Blue cell
detailCell = [detailSection cellAtIndex:1];
detailCell.backgroundColor = [UIColor blueColor];
UIImageView *bg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bluelinetheme.png"]];
bg.frame = CGRectMake(0.0f, 0.0f, 50.0f, 50.0f);
UITableView *tv = detailTableViewModel.modeledTableView;
tv.opaque = NO;
tv.backgroundView = bg;
[tv reloadData];
}