Re: Observing managed arrays in custom views?
Re: Observing managed arrays in custom views?
- Subject: Re: Observing managed arrays in custom views?
- From: Jonathan del Strother <email@hidden>
- Date: Wed, 8 Mar 2006 13:22:06 +0000
On 8 Mar 2006, at 00:02, mmalcolm crawford wrote:
On Mar 7, 2006, at 3:52 PM, Jonathan del Strother wrote:
I have a Core Data entity 'MovieClip' bound to an
NSArrayController's managedObjectContext binding. So far, so good.
Not as described.
You should have an array controller whose 'managedObjectContext'
binding is bound to wherever the managed object context is (if
you're using NSPersistentDocument, then probably from File's Owner).
Yeah, ok, it was poorly described. It's a document-based app, and
the array controller is bound to File's Owner (MyDocument) with a key
path of managedObjectContext.
I have a subclassed NSView which is intended to display a
representation of all the clips in the array. So I need to do -
exposeBinding:@"clips" - so that the clips binding appears in the
Interface Builder inspector. This then requires the custom view
to implement 'setClips' and 'clips' methods
No, it doesn't. Names of bindings can be independent of instance
variables, although they often coincide.
Huh. I could've sworn that when I didn't have setClips & clips
methods, I got errors about the view not being key-coding compliant
for "clips", but you're right - it seems to do fine without it. I
must've changed something else in the meantime...
When an element is added/removed from the array, I want to update
the view. But this doesn't tell us when the contents of an
element changes, so we also need to observe each element in the
array.
[...]
Secondly, there are a number of Clip attributes that I'm
interested in - not just the title. Is there a way of observing
all attributes without specifying each one manually?
In essence, no.
For a full example, see <http://homepage.mac.com/mmalc/
CocoaExamples/controllers.html> (Graphics Bindings).
That looks pretty helpful, thanks. I'll work through it - I'm sure
I'll be back later with more questions. :)
Jon
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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