Hi again!
Tried it but i get the memory adresse of the property rather then its value (something like <Adresse: 0x700c590> enti...) in the title now. Is it the the class definition of the sub entity (which is a relationship) that is causing the problem? Or maybe my property def? Again my Propriete Entity as a one to one relationship with my Adresse Entity. I need the Adresse Entity's "Rue" property to show up as a title to the Propriete Entity.
- (void)viewDidLoad {
[super viewDidLoad];
// Set up the edit and add buttons.
self.navigationItem.leftBarButtonItem = self.editButtonItem;
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject)];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];
// Creation de nouvelles instances des entites
AppDelegate_Shared *appDelegate = [[UIApplication sharedApplication] delegate];
self.managedObjectContext = [appDelegate managedObjectContext];
// Create a class definition for AdresseEntity
SCClassDefinition *adresseDef =
[SCClassDefinition definitionWithEntityName:@"Adresse"
withManagedObjectContext:self.managedObjectContext
withPropertyNames: [NSArray arrayWithObjects:@"rue", @"ville", @"province",@"pays",@"codePostal", nil]];
adresseDef.titlePropertyName = @"rue";
// Create a class definition for ProprieteEntity
SCClassDefinition *proprieteDef =
[SCClassDefinition definitionWithEntityName:@"Propriete"
withManagedObjectContext:self.managedObjectContext
withPropertyNames: [NSArray arrayWithObjects:@"adresse", nil]];
SCPropertyDefinition *adressePropertyDef = [proprieteDef propertyDefinitionWithName:@"adresse"];
adressePropertyDef.attributes = [SCObjectAttributes attributesWithObjectClassDefinition:adresseDef];
// Instantiate the tabel model
tableModel = [[SCTableViewModel alloc] initWithTableView:self.tableView withViewController:self];
// Create and add the objects section
SCArrayOfObjectsSection *objectsSection = [SCArrayOfObjectsSection sectionWithHeaderTitle:nil
withEntityClassDefinition:proprieteDef];
objectsSection.addButtonItem = self.navigationItem.rightBarButtonItem;
[tableModel addSection:objectsSection];
}
Thanks!