Welcome, Guest
Username Password: Remember me

Background Color of SCSelectionAttributes
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Background Color of SCSelectionAttributes

Background Color of SCSelectionAttributes 1 year, 6 months ago #1

Hi again!

I'm having a few problems with the background color of the SCSelectionAttributes screen which is displayed.

I have the following
- (void)willDisplayCell:(SCTableViewCell *)cell
...
if([cell isKindOfClass:[SCSelectionCell class]]) {
SCSelectionCell *selCell = (SCSelectionCell *)cell;
selCell.detailTableViewStyle = UITableViewStyleGrouped;
}
...

so that it forces the new detailTableViewStyle to be grouped and not plain. However it doesnt seem to preserve the background color from the parent tableview. The new detail tableview falls back to the default grey color. I have also tried the following which doesn't work :
selCell.ownerTableViewModel.modeledTableView.backgroundView = nil;
selCell.ownerTableViewModel.modeledTableView.backgroundColor = [UIColor colorWithRed:232.0f/255 green:229.0f/255 blue:221.0f/255 alpha:1.0f];

Does that set the color of the current tableview not the detailTableView ??
  • monsta
  • OFFLINE
  • Expert Boarder
  • Posts: 130
  • Karma: 2
Last Edit: 1 year, 6 months ago by monsta.

Re: Background Color of SCSelectionAttributes 1 year, 6 months ago #2

Hey Phil,

You can fully access that cell's detail view model and detail table view by implementing the SCTableViewModelDelegate method called tableViewModel:detailViewWillAppearForRowAtIndexPath:withDetailTableViewModel:. Here is some sample code:

 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel
detailViewWillAppearForRowAtIndexPath:(NSIndexPath *)indexPath
withDetailTableViewModel:(SCTableViewModel *) detailTableViewModel
{
detailTableViewModel.modeledTableView.backgroundColor =
[UIColor colorWithRed:232.0f/255 green:229.0f/255 blue:221.0f/255 alpha:1.0f];
}
 


We're also planning for the next release to automatically inherit its parent table view's properties.

Hope this helps!
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Background Color of SCSelectionAttributes 1 year, 6 months ago #3

Hi,

Yeah I have tried the code in that method as well but still it doesn't change the background color.

I define the SCSelectionAttributes cell as :

SCPropertyDefinition *statePropertyDef = [inspectionDef propertyDefinitionWithName:@"state"];
statePropertyDef.required = TRUE;
statePropertyDef.title = @"State";
statePropertyDef.type = SCPropertyTypeSelection;
statePropertyDef.attributes = [SCSelectionAttributes attributesWithItems:
[NSArray arrayWithObjects: kWA, kACT, kNT, kNSW, kQLD, kSA, kTAS, kVIC, nil]
allowMultipleSelection:NO
allowNoSelection:NO
autoDismissDetailView:YES
hideDetailViewNavigationBar:NO];
  • monsta
  • OFFLINE
  • Expert Boarder
  • Posts: 130
  • Karma: 2

Re: Background Color of SCSelectionAttributes 1 year, 6 months ago #4

Are you sure the method you implemented is being called?
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Background Color of SCSelectionAttributes 1 year, 6 months ago #5

Hi,

No that method isn't being called when that cell is clicked. From my understanding its a selectioncell not a detailView at that level ??
  • monsta
  • OFFLINE
  • Expert Boarder
  • Posts: 130
  • Karma: 2

Re: Background Color of SCSelectionAttributes 1 year, 6 months ago #6

I found the issue. I should be implementing

- (void)detailViewWillAppearForCell:(SCTableViewCell *) cell withDetailTableViewModel:(SCTableViewModel *) detailTableViewModel


which fixed the issue. Thanks for your help.
  • monsta
  • OFFLINE
  • Expert Boarder
  • Posts: 130
  • Karma: 2
  • Page:
  • 1
Time to create page: 1.00 seconds