Welcome, Guest
Username Password: Remember me

tableViewModel:commitEditingStyle:onRowAt with SCArrayOfObjectsSection
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: tableViewModel:commitEditingStyle:onRowAt with SCArrayOfObjectsSection

tableViewModel:commitEditingSt​yle:onRowAt with SCArrayOfObjectsSection 1 year, 6 months ago #1

I would like to load a UITableViewController in editmode so that the control buttons (delete, add) are visible as soon as the view displays without the user having to click an edit button. I am currently accomplishing this with:
[self.tableView setEditing:TRUE];
Am I going about this the correct way?

Within this UITableViewController I have an SCArrayOfObjectsSection that contains objects pulled form a database + one extra object that is the "Add Object" placeholder. I use tableViewModel:willConfigureCell:forRowAtIndexPath: to have all cells display the delete control (using cell.cellEditingStyle = UITableViewCellEditingStyleDelete) except for the last cell that I set to UITableViewCellEditingStyleInsert. I need to perform some custom behavior when the delete button is tapped and confirmed and also when the insert button is tapped. I thought tableViewModel:commitEditingStyle:onRowAtIndexPath: would be the place to do this but that method never seems to get fired. I believe I have tried all of the delegate methods that seem to make sense but none get fired when I tap the buttons.

Thanks.
  • kes815
  • OFFLINE
  • Junior Boarder
  • Posts: 32
  • Karma: 0
Last Edit: 1 year, 6 months ago by kes815. Reason: misspelled method names...

Re: tableViewModel:commitEditingSt​yle:onRowAt with SCArrayOfObjectsSection 1 year, 6 months ago #2

Hi Karl,

Are you sure you're conforming to the SCTableViewModelDataSource protocol? Please note that tableViewModel:commitEditingStyle:forRowAtIndexPath: method belongs to that protocol, and not the SCTableViewModelDelegate protocol. Also, I notice that you have misspelled the method name as "onRowAtIndexPath" instead of "forRowAtIndexPath", this could also be the source of the problem.

Please tell me if the above fixes your issue.

(BTW, yes, [self.tableView setEditing:TRUE] is the correct way to go )
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: tableViewModel:commitEditingSt​yle:onRowAt with SCArrayOfObjectsSection 1 year, 6 months ago #3

That was it! I was conforming to the model and cell delegates but not the datasource delegate. I must need more coffee! Anyway, thank you for saving me a few more hours of banging my head against the wall
  • kes815
  • OFFLINE
  • Junior Boarder
  • Posts: 32
  • Karma: 0
  • Page:
  • 1
Time to create page: 0.77 seconds