I have my STV bound to a Core Data entity and the STV lists each object within the entity. There is of course an Add (+) button allowing the user to add a new object. I have somewhat customised the detail view controller that appears to add a new object by adding a custom table view footer with a segmented control (this customisation is done in the - (void)tableViewModel:(SCTableViewModel *) tableViewModel detailViewWillAppearForSectionAtIndex:(NSUInteger) index withDetailTableViewModel:(SCTableViewModel *) detailTableViewModel delegate method).
I need some way to get a reference to the newly created Core Data object so that I can manually set the object's attribute which relates to the custom control within the table view footer.
This is easy when editing an existing object, as I can get a reference to the object using the following code within the detailViewWillAppearForRowAtIndexPath method:
SCArrayOfObjectsSection *objectsSection = (SCArrayOfObjectsSection *)[tableViewModel sectionAtIndex:indexPath.section]; CoreDataObject *coreDataObjectForCell = (CoreDataObject *)[objectsSection.items objectAtIndex:indexPath.row];
However, I don't know how to get the reference to the newly created object. I guess this all depends on when the object is created - when the user taps the Add (+) button or when the Done button is tapped to dismiss the view. Either way, any assistance to get the reference would be appreciated.
P.S. I realise that I could use a SCPropertyTypeSegmented within the STV itself. However, I need to put the control within the footer for other reasons specific to my implementation (plus, in other table views I use other custom controls so this question has wider applicability).
Thanks for any help!