Binding a model's ivar array to the contents of an NSArrayController
Binding a model's ivar array to the contents of an NSArrayController
- Subject: Binding a model's ivar array to the contents of an NSArrayController
- From: A B <email@hidden>
- Date: Wed, 16 Sep 2009 08:29:55 -0700
I have an NSView that is keeping track of a group of objects via an NSMutableArray ivar (let's call it relatedObjects). Objects in this array are represented in the view by subviews (i.e. when I add an object to the array, a new subview appears, when I delete them, the associated subview is removed, etc.) I'd like to expand the functionality of my NSView class by letting that array of objects be bound to an NSArrayController... unfortunately, I'm stymied by the very first step: That of actually getting relatedObjects to mirror the contents of the controller.
So in short, my need is pretty simple: Bind an array to an NSArrayController. That being said, it seems that no combination of exposeBindings:, bind:toObject:withKeypath:options:, observeValueForKey:ofObject:change:context:, etc. is working as I expect it to. Admittedly, I have done most of my binding work via IB and I've never really done much with bind:toObject:withKeypath:options: before, so I wouldn't be surprised to find that that was where my problem lay.
Can anybody offer any general tips as to how I might be able to accomplish this? I'm sure that this is one of those basic things that once I get it I'll do a full-on forehead slap when the light goes on, but right now I'm just feeling around in the dark.
_______________________________________________
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