Re: Core Data / Bindings question
Re: Core Data / Bindings question
- Subject: Re: Core Data / Bindings question
- From: Phil <email@hidden>
- Date: Tue, 26 Jun 2007 17:55:43 -0400
On Jun 26, 2007, at 5:13 PM, mmalc Crawford wrote:
but only somewhat successful when I bring CD into the mix. I'm
trying to create a binding to an entity so that I can observe any
additions to the entity in question but am not clear on how to
accomplish this. I'd appreciate any enlightenment or pointers to
example code and/or docs that specifically cover creating manual
bindings using Core Data in this manner.
You typically use an array controller and set it to automatically
prepare content:
<http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/Classes/NSArrayController_Class/Reference/
Reference.html#//apple_ref/occ/instm/NSArrayController/
setAutomaticallyPreparesContent:>
That's about as far as I've gotten (and that portion is working as
expected)... but I'm struggling with how to make my code aware of
when a managed object is added to an entity and what it was (i.e. the
instance) that was added? I'm attempting to do the same thing that
the Sketch example app does with the 'graphics' binding: an object
gets added to the collection (non-Core Data in this example) and a
view's observing code is notified of the added object which, in turn,
create bindings to a property of interest that the view needs to keep
track of.
In my example, I have a custom view (myView), an array controller
(myAC) which is bound to myPersistentDocument's managedObjectContext
which has an entity (myObject.) The basics are working as expected:
I can add/delete, change selections, etc. But what isn't working is
that myView isn't updating appropriately because I'm missing the
binding which causes myView's observing code to be made aware of the
added myObject. Hopefully that clarifies my question/problem.
(Note: I've got a hackish solution which is to assume that when I
see an updated current selection it may be the result of adding a new
object but it's an indirect and flawed approach at best IMO)
Thanks,
Phil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden