I have 4 entities in my core data with the same parent entity. They almost share the same properties.
I need to use the same xib fie (a panel to modify the entities properties), for 3 of these 4 entities. The remaining one is using another panel. If the user selects more entities, the same NSTextField is used to modify the respective properties in all those selected entities.
How can I bind the objects in my xib file to the different entities, should I bind them to the parent entity? (In the parent I don’t have all properties though).
I have a lot of text fields in the xib file, binding them programmatically would be quite a lot of work. Binding in interface builder is much easier.
thanks
Assuming that you are using some sort of controller in IB (
NSArrayControllerorNSObjectController) to manage your entities, you can create an outlet for that controller in your view controller.Then in the
awakeFromNibmethod you can do:The entity controller would then be set to use the entity of your choice. This approach would still allow you to make the bindings in IB. The only downside might be that IB cannot show you the possible attributes to bind against as the actual entity is only determined at run time.