Welcome, Guest
Username Password: Remember me

SCPropertyTypeSelection: Different values for cell and list
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: SCPropertyTypeSelection: Different values for cell and list

SCPropertyTypeSelection: Different values for cell and list 1 year, 5 months ago #1

Hey,

I have a cell from type SCPropertyTypeSelection. This displays a detail view controller with a selection list. (It's an alarm app and you can choose on which weekdays you want to be woken.) It says "On Thursday" and so on there.
The user can select multiple values there. (screen 2)

When the user gets back to the table view where he has been before (screen 1), the cell should not display "On Thursday", but "Thu". If nothing is selected, it should state "Never". If only Saturday and Sunday are selected, it should say "On Weekend". I need to customize that.

Any idea how to achieve that?

Thanks,
Patrick



screen 1:
Bildschirmfoto_2010_12_01_um_20.png


screen 2:
Bildschirmfoto_2010_12_01_um_20-20101201-2.png
Attachments:
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3
Last Edit: 1 year, 5 months ago by Patrick.

Re: SCPropertyTypeSelection: Different values for cell and list 1 year, 5 months ago #2

Hey Patrick,

You can fully customize what an SCSelectionCell displays by implementing the SCTableViewModelDelegate method called willDisplayCell. Here is a code sample:

 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel
willDisplayCell:(SCTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if([cell isKindOfClass:[SCSelectionCell class]])
{
SCSelectionCell *selectionCell = (SCSelectionCell *)cell;
 
if(/* Do your test here on selectionCell.selectedItemsIndexes */)
selectionCell.label.text = @"On weekend";
else
// etc.
}
}
 


Please tell me if you need any more help.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: SCPropertyTypeSelection: Different values for cell and list 1 year, 5 months ago #3

Hi Tarek,

thanks fore the code sample. I needed to place that code in detailViewWillDisappearForCell: to get the cell's value updated when the detail view has been dismissed.

- Patrick
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3
  • Page:
  • 1
Time to create page: 1.48 seconds