Welcome, Guest
Username Password: Remember me

User added Cells
(1 viewing) (1) Guest

TOPIC: User added Cells

User added Cells 1 year, 4 months ago #1

Afternoon

Is it possible for SC to be setup that would allow the user to create new cells and labels within an App ? perhaps you set up a sample form, which the user can then customize including the title that is listed say in the Root View Controller listing.

Iain
  • ihmunro
  • OFFLINE
  • Expert Boarder
  • Posts: 135
  • Karma: 0

Re: User added Cells 1 year, 4 months ago #2

Hi Iain,

Sure, all you need to do is add the cell to your section and then reload that section. Here is a code sample that might be of help to you:

 
- (void)buttonTapped:(id)sender
{
// get the first section in the model
SCTableViewSection *section = [tableModel sectionAtIndex:0];
 
SCLabelCell *labelCell = [SCLabelCell cellWithText:@"Label"];
labelCell.label.text = @"My label text";
[section addCell:labelCell];
 
// reload the section for the added cell to appear
NSIndexSet *sectionIndexes = [NSIndexSet indexSetWithIndex:0];
[tableModel.modeledTableView reloadSections:sectionIndexes
withRowAnimation:UITableViewRowAnimationBottom];
}
 


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

Re: User added Cells 1 year, 4 months ago #3

Hi tarekskr

Thanks for the code.

I am still not sure where to add it.

I still need to play with SC some more.

Do you have a working sample ?

Iain
  • ihmunro
  • OFFLINE
  • Expert Boarder
  • Posts: 135
  • Karma: 0

Re: User added Cells 1 year, 4 months ago #4

Hi Iain,

My code was just assuming you have a button on your view, and you've added the method "buttonTapped:" as a target action for the control event UIControlEventTouchUpInside.

I can also provide you with a sample for your specific case. How are you planning for the user to add cells? Is there a button for example that the user will tap? Where do you want this button to exist?
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: User added Cells 1 year, 4 months ago #5

Hi Tarekskr

What I was hoping to do was provide a framework that the user that add, modify or delete.

What I was thinking of was for an audit - I can provide the main items for the audit, such as date, area audited, requirement, finding and auditor.

The user should be able to then modify the labels as required, delete the entire label and field or modify to suit as well as be able to add a label or field to the form entry.

Iain
  • ihmunro
  • OFFLINE
  • Expert Boarder
  • Posts: 135
  • Karma: 0

Re: User added Cells 1 year, 4 months ago #6

Hi again Iain,

That's really interesting! May I have an idea on how are you planning to persist/save all this? (e.g. SQLite, Core Data, etc.)
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
Time to create page: 1.80 seconds