Re: getting started on bindings => problems with NSMutableArray - NSArrayController - NSTableView
Re: getting started on bindings => problems with NSMutableArray - NSArrayController - NSTableView
- Subject: Re: getting started on bindings => problems with NSMutableArray - NSArrayController - NSTableView
- From: Quincey Morris <email@hidden>
- Date: Mon, 21 Sep 2009 09:36:18 -0700
On Sep 20, 2009, at 13:51, Colin Howarth wrote:
It's really frustrating. The examples I find either don't seem to
fit what I'd like to do (NSMutableArray - NSArrayController -
NSTableView). And/or they use ancient versions of IB (which keeps
changing). Or they don't use IB at all. Or, like me, they just
mention some settings, but ignore others - like "Table View
Attributes >> Control >> State: Enabled" or "Array Controller
Attributes >> Object Controller >> Editable (yes)". Sometimes I see
columns bound. Sometimes ControllerKey is "selections" sometimes
it's "arrangedObjects". And nothing works. The documentation only
makes sense when you know exactly what it's talking about. :-(
Use arrangedObjects, not selection. You'd bind to
arrayController.selection if you were doing a master-detail kind of
interface. In your case, you're showing all of the
"arranged" (possibly sorted and filtered) content, hence
arrayController.arrangedObjects.
You have another problem. Your array controller is going to get
unarchived before the flow of control reaches
applicationDidFinishLaunching and your content array is created. That
means the array controller's content is nil, and that's never going to
change because you're updating the "elements" property non-KVO-
compliantly in applicationDidFinishLaunching.
In the short term you could try re-setting the array controller's
content array programmatically at the end of
applicationDidFinishLaunching. That's not really the correct answer,
though. The correct answer probably involves moving your window to its
own XIB file, and sorting out your KVO compliance issues.
_______________________________________________
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