KVO and master-detail NSTableViews
KVO and master-detail NSTableViews
- Subject: KVO and master-detail NSTableViews
- From: Stefan Reitshamer <email@hidden>
- Date: Thu, 4 Jun 2009 06:24:20 -0400
I'm getting flaky behavior from my KVO code and I'm wondering what I'm
doing wrong. I can't find any similar examples.
I have a pop-up button and 2 NSTableViews.
The pop-up button selection controls the content of the left
NSTableView. The left NSTableView's selection controls the content of
the right NSTableView.
The pop-up button and NSTableViews are bound to separate
NSArrayControllers.
Each NSArrayController is bound to a separate NSMutableArray property
in my app controller.
My app controller observes "selectionIndex" in the pop-up button's
NSArrayController and "selectedObjects" in the left NSArrayController.
On startup, the pop-up button is populated, which causes a call to
observeValueForKeyPath:ofObject:change:context:. This sets the left
NSMutableArray, which in turn causes another (nested) call to
observeValueForKeyPath:ofObject:change:context:, which sets the right
NSMutableArray.
There seems to be a race condition -- sometimes the left table view is
populated, sometimes the right, sometimes none. Each time I edit the
nib, the behavior changes.
Is this a bogus way to implement the dependent NSTableViews?
What's the right way?
Thanks in advance,
- Stefan
_______________________________________________
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