Welcome, Guest
Username Password: Remember me

Ability to let user rearrange the SCTableViewSelection table view
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Ability to let user rearrange the SCTableViewSelection table view

Ability to let user rearrange the SCTableViewSelection table view 1 year, 8 months ago #1

Hi

Is there a way to do that?

thanks

Shani
  • shannoga
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 1

Re: Ability to let user rearrange the SCTableViewSelection table view 1 year, 8 months ago #2

Do you mean an SCSelectionSection? Would you please elaborate on that? Thanks.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Ability to let user rearrange the SCTableViewSelection table view 1 year, 8 months ago #3

sure

i am using that code -
 
//categories settings cells
SCTableViewSection *categoriesSection = [SCTableViewSection sectionWithHeaderTitle:NSLocalizedString(@"Categories Settings",@"")];
[tableModel addSection:categoriesSection];
 
SCSelectionCell *presetCategoriesCell = [SCSelectionCell cellWithText:NSLocalizedString(@"Preset categories",@"") withBoundKey:@"selectedIndexes" withSelectedIndexesValue:selectedIndexes withItems:categories allowMultipleSelection:YES];
presetCategoriesCell.detailTableViewStyle = UITableViewStyleGrouped;
presetCategoriesCell.showsReorderControl = YES;
[categoriesSection addCell:presetCategoriesCell];
 
 
NSMutableArray * images = [[NSMutableArray alloc] init];
 
for(int i=0;i<[categories count];i++){
// UIImage *img = [UIImage imageNamed:@"Work_l.png"]
imageView=nil;
imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[categories objectAtIndex:i]]];
[images addObject:imageView];
[imageView release];
}
 
 
presetCategoriesCell.detailCellsImageViews =images;
 
 
presetCategoriesCell.displaySelection=NO;
 
SCTableViewCell *CategoriesCell = [SCTableViewCell cellWithText:NSLocalizedString(@"Add custum categories",@"") withBoundKey:@"presetCategories" withValue:nil];
[categoriesSection addCell:CategoriesCell];
 


and i wish that the user can rearrange the items in the categories table view that he gets.

thanks

shani
  • shannoga
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 1

Re: Ability to let user rearrange the SCTableViewSelection table view 1 year, 8 months ago #4

You just need to set the "movable" property of all detail selection cells to TRUE. To do that, you need to first conform to the SCTableViewModelDelegate in your view controller's header file. Then, in the implementation file, please add the following methods:

 
- (void)tableViewModel:(SCTableViewModel *) tableViewModel
detailViewWillAppearForRowAtIndexPath:(NSIndexPath *) indexPath
withDetailTableViewModel:(SCTableViewModel *) detailTableViewModel
{
// Set the detail table view model's delegate to self so that you can handle
// the willConfigureCell method
detailTableViewModel.delegate = self;
}
 
// Now handle the willConfigureCell method
- (void)tableViewModel:(SCTableViewModel *)tableViewModel
willConfigureCell:(SCTableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath
{
if(tableViewModel != tableModel) // Make sure it's the detail model not the main model
{
cell.movable = TRUE;
}
}
 


Please tell me if this helps.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
Time to create page: 0.93 seconds