Adding objects to NSArrayController bound to Core Data
Adding objects to NSArrayController bound to Core Data
- Subject: Adding objects to NSArrayController bound to Core Data
- From: Matteo Manferdini <email@hidden>
- Date: Sun, 14 May 2006 19:09:36 +0200
Hi everyone. I have a custom view which displays objects present in a
core data context. My view is bound to an NSArrayController and gets
items via arrangedObjects method. Everything works fine.
Now I want to add objects in the core data context when the user
double-clicks on the view. How I do that via the controller?
NSArrayController class has a addObject: method, but since the
controller is bound to core data the object must be a managed object.
But when you create a managedObject it is already created in the
context. I can create the object this way and then add it to the
controller, but I think this is a wrong way since I skip the
controller and go directly into core data. I feel this is wrong also
because when you connect a button to the add: method of the
controller, it's the controller that creates the new object.
How shoul I do this?
Thank you all.
Cheers.
---
Matteo Manferdini
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden