Manually adding objects to NSArrayController
Manually adding objects to NSArrayController
- Subject: Manually adding objects to NSArrayController
- From: Jenny M <email@hidden>
- Date: Thu, 18 Mar 2010 12:10:30 -0700 (PDT)
Hi all, I'm having a problem adding the appropriate objects to an
NSArrayController. For some strange object model reasons, I will
probably need to set this by hand, but I'm having issues.
Back to my silly object discussions... before, it was about an
NSTreeController which I did get resolved, but now it's about an Array
Controller.
Alpha >> has multiple Betas >> has multiple Deltas
I need an NSPopUpButton to contain all of the Deltas for the one
Alpha. Right now the NSPopUpButton is bound alright to the
NSArrayController. The default NSArrayController setup seems to
automatically pull *all* Delta types, NOT just the ones that exist
under that Alpha, so I'm trying to do it manually.
What I tried to do is reference the NSArrayController in my code, and
manually add all objects to the array controller, and that's where I'm
failing. On the surface it seems to work fine, because my log
statements indicate that I'm iterating through and adding only the
small subset of Deltas. But the array controller isn't being set with
the content!
Here's a code snippet:
getDeltas Method{}
...make nsmutable set of deltas...
[deltasController addObjects:[deltaItems allObjects]];
NSLog(@"number of items in array: %u", [deltaItems count]); // this
returns 3
NSLog(@"number of items in array controller: %u", [[deltasController
arrangedObjects] count]); // this returns 0
So the deltaItems array is fine, but calling addObjects on the array
controller is not *actually* setting! I also tried the setContent
method with the same results.
Also interestingly, when I go back to the parent item and try to see
how many items the array controller has (with the same log statement
as the second one above), it returns null, not 0. So is it somehow not
initialized yet in the method I'm working in??
Any help is appreciated....thanks....
_______________________________________________
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