Hi Tarek,
thank you very much for your reply, it's been very helpful!
I followed your advice and used the example code to calculate the values of the properties I wanted.
I have however still 3 issues:
1st issue:
the values are calculated only when I click on the "Done" button, not when I change the others fields values.
What I would like is to see the auto-calculated fields' values change when I finish editing one of the other textfields, but now I have to click 'Done' which takes me out of the Details screen, and then enter the Details screen again...
Before bothering you again I tried to dig in the forum and I found another post where you suggested the user to:
a- set the delegate to the detail model using this method:
- (void)tableViewModel:(SCTableViewModel *)tableViewModel detailModelCreatedForRowAtIndexPath:(NSIndexPath *)indexPath
detailTableViewModel:(SCTableViewModel *)detailTableViewModel {
detailTableViewModel.delegate = self;
// Set the tag property of the detail model to correspond to its level in the hierarchy
detailTableViewModel.tag = tableViewModel.tag + 1;
}
I tried it in my app but I get an error saying: "property delegate not found for object of type SCTableViewModel"
b- The the cells' boundValue only changes when the end-user actually taps the 'Done' button and the changes get committed to Core Data. To access the cells' values before they're committed, simply:
- (void)tableViewModel:(SCTableViewModel *) tableViewModel valueChangedForRowAtIndexPath:(NSIndexPath *) indexPath
{
SCTableViewSection *section = [tableViewModel sectionAtIndex:indexPath.section];
if([section isKindOfClass:[SCObjectSection class]])
{
SCObjectSection *objectSection = (SCObjectSection *)section;
// Now assuming you have a property called "income" in the class def
SCTextFieldCell *incomeCell = (SCTextFieldCell *)[objectSection cellForPropertyName:@"income"];
double incomeValue = [incomeCell.textField.text doubleValue];
// etc...
...
}
}
this method doesn't get fired I assume because I haven't managed to set the delegate for the detail model?
2nd issue:
Curly Brace Binding not working anymore
In the Locations List I have 2 fields where I use {nameOfTheProperty1} and {nameOfTheProperty2} to get the corresponding values.
It worked fine before I changed Property1 and Property2 from textfields to labels and used your code to auto calculate their values.
How can I use curly brace binding to get the values of the auto calculated properties displayed into the general list cell?
3rd issue:
Generate Detail Section breaks auto calcultation
If I leave the UI as generated from the template the auto calculated fields work fine.
If in the storyboard I click on "Generate Details Section(s)" button to customise the details screen's UI, the details screen is correctly generated in the storyboard but the auto calculated field are no more automatically calculated.
Whatever I enter in the other fields, clicking "done" button etc. they don't change.
Sorry to bother you again, I tried to sort those 3 issues myself but didn't manage to do so...
I hope this is clear enough,
thank you for your time and help, much appreciated
Edited by yesss, 14 August 2015 - 02:44 PM.