Re: Binding multiple NSTableView and NSPopupButton to an NSArrayControler
Re: Binding multiple NSTableView and NSPopupButton to an NSArrayControler
- Subject: Re: Binding multiple NSTableView and NSPopupButton to an NSArrayControler
- From: Quincey Morris <email@hidden>
- Date: Mon, 02 May 2011 13:15:12 -0700
On May 2, 2011, at 12:47, email@hidden wrote:
> anotherItemController
> Content Array
> Bind to: MyAppsClass (added an NSObject from palette and set its class to MyAppsClass)
> Controller Key: myMutableArray
If this is what you were calling a "proxy" earlier, it isn't. It's a separate instance of MyAppsClass that's (re-)created when the nib is loaded.
I'm assuming that MyAppsClass represents an app delegate singleton. The normal way to create it is to place an instance in the MainMenu nib, and connect the Application proxy's delegate outlet to it.
If the nib file you're referring to above is actually the MainMenu nib, then that's fine. If not, then you've created a second instance -- you shouldn't have added a NSObject from the palette, but should have bound to the Application proxy instead, using the "delegate" key to get to the existing singleton object.
> If I set a breakpoint after the item has been removed and then in gdb: po (NSArray*)[mycontroller arrangedObjects] . The removed item is not in the array. If during archiving, I do the same, the removed item is back.
You kind of sidestepped the question here. There are, if I understand correctly, 2 different array controllers (one for each NIB), both of which are supposed to use the same underlying data model array for their content. You're not saving the array controllers (at least I hope not), but you're saving the underlying data model. Therefore looking at the array controller (or even their arrangedObjects) doesn't tell you anything about what's being saved.
What you should be trying to resolve, using the debugger, is the question of whether there are 2 underlying data model arrays when there should be only one. To do that, you need to be looking at the object address of the mutable array(s).
_______________________________________________
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