I have a to-many relationship between two objects: OBJ <<---->> ACTION
Every OBJ has a set of ACTIONs, which can be executed if the status of an other OBJ has a certain value. So the entities are:
alias (the name of the Obj)
status (its integer status)
actions (the possible actions for this Obj)
title (the name of the action)
conditionObj (the Obj whose status is tested)
This is the Model. Now for the View part:
I have a table view containing the ACTIONs. On each row, there is a pop menu to select the conditional OBJ for this ACTION.
The Controller part for this pop menu is unclear for me: I get only errors or insignificant results. I bind:
The “Title” table column to ACTIONController.title
The “Conditional Object” table column contains a pop menu. For this pop menu, I bind
The Content to the OBJController.arrangedObjects
The Content Values to the OBJController.arrangedObjects.alias
So far so good. But what for the Selected Value?
I hope I’ve made myself clear enough. Can you help me, please?
For selection you could also bind Selected Index to OBJController.selectionIndex
I found: it was “Selected Objet”, as the relation to the menu item IS an object. The value or the tag will of course be correct, because they belong to the object.
More, I made everything work by adding a new relationship between “OBJ” and “ACTION”.
targetObject <------->> actions
conditionObject <------->> condition
If I don’t, the inverse relationship always refers to the same (self) object. So, by changing a relationship, I was changing the object itself!
By adding a new one-to-many relationship, I can indirectly make a OBJ to OBJ relation (the targetObject and conditionObject may be the same one) AND keep the graph consistent.
Each day, I understand better what “Core Data is not for beginners” means.