Hi Tarek,
As a first post I believe its almost de-rigeur, and most certainly deserved, to begin with complements on the groundbreaking nature of STV.
I expect to have difficulty using some of the more advanced features to begin with, but I'm totally stumped on something that appears as if it should be simple.
I'm using a core data model with a 1-1 relationship between Trip and Boat. What I'd like to do is have a view to allow a selection of one of a list of all boats - and give the user the option to add a new boat to the list and select that. I see that SCArrayOfObjectsAttributes has an allowsAdding attribute, but SCObjectSelectionAttributes does not.
Here's the relevent code snippet I'm using:
SCClassDefinition *boatDef = [SCClassDefinition definitionWithEntityName:@"Boat"
withManagedObjectContext:self.managedObjectContext withPropertyNames:[NSArray arrayWithObjects:@"name", @"make", @"model", nil]];
SCClassDefinition *tripDef = [SCClassDefinition definitionWithEntityName:@"Trip"
withManagedObjectContext:self.managedObjectContext
withPropertyNames:[NSArray arrayWithObjects:@"name", @"startDate", @"boat", nil]];
SCPropertyDefinition *boatPropertyDef = [tripDef propertyDefinitionWithName:@"boat"];
boatPropertyDef.type = SCPropertyTypeObjectSelection;
boatPropertyDef.attributes = [SCObjectSelectionAttributes attributesWithItemsEntityClassDefinition:boatDef
withItemsTitlePropertyName:@"name"
allowMultipleSelection:NO
allowNoSelection:YES];
tableModel = [[SCTableViewModel alloc] initWithTableView:self.tableView withViewController:self];
SCObjectSection *overviewSection = [SCObjectSection sectionWithHeaderTitle:@"" withBoundObject:self.trip withClassDefinition:tripDef];
[tableModel addSection:overviewSection];
Nor in this case is it possible to do something like:
((SCPropertyAttributes*)boatPropertyDef.attributes).allowsAdding = YES;
Am I trying to do something inherently impossible, not yet enabled or most likely what am I doing wrong?
With thanks in advance,
James