Creating an ordered list for combo-box content from a Core Data entity attribute
Creating an ordered list for combo-box content from a Core Data entity attribute
- Subject: Creating an ordered list for combo-box content from a Core Data entity attribute
- From: "Jon C. Munson II" <email@hidden>
- Date: Wed, 8 Apr 2009 16:05:05 -0400
- Organization: JTA Enterprises LLC
Namaste!
I have a combo-box whose content needs to be the aggregated values of the
attribute it is bound to. Ideally, I'd like this sorted.
Binding content/content values to @distinctUnionOfObjets.attribute yields an
unordered list - not quite so friendly.
So, I've created a relevant method to fetch & load an ordered list.
Now, I'd like to monitor that attribute for any change so I can re-load my
list.
I'm pouring through as much relevant KVO documentation as I can find, but
I'm missing something.
In my window controller class, I'd simply like to:
[myCoreDataEntityObject addObserver:self forKeyPath:@"attribute"...];
Is that possible, and, how do I obtain the myCoreDataEntityObject? I tried:
NSManagedObjectContext *moc...
NSEntityDescripton *entityDescription...
[entityDescription addObserver:self...
And I'm sure those of you experts out there will laugh at that one...:)
I see from mmalc's controllers page
(http://homepage.mac.com/mmalc/CocoaExamples/controllers.html for anyone
that doesn't have the reference) in the "Observing a collection..." section:
"You need to register as an observer of the relevant properties of each of
the objects in the array, and as an observer of the array itself so you can
add yourself as an observer when a new object is added to the array and
remove yourself when an object is removed from the array."
I am using an array controller, so I have an IBOutlet to it. Is the only
way to iterate through the set of objects in that arraycontroller as stated
by the summary in order to accomplish my goal?
I did find and read Jerry Krinock's radar on this issue (at least it appears
to be similar).
I'm having trouble locating a relevant sample.
Thanks!!!
Peace, Love, and Light,
/s/ Jon C. Munson II
P.S. mmalc - I know you and I got off on a bad foot, but I wanted to thank
you for your examples regardless.
_______________________________________________
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