Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Observing 'many' managed objects in custom view



I'd like my custom view, not an NSTableView, to display many objects of a Core Data entity, filtered and sorted. I've got it 90% working, but the difficulty I'm having with the last few issues makes me think that maybe my whole approach is wrong. My custom view does not have any exposed bindings, so I observe using KVO. (The NSArrayController/ NSManagedObjectContext binding is read-only anyhow.)

1. Should/Must I have an NSArrayController? Only NSObjectController and its subclass NSArrayController seem to have the capability of operating in "Entity" mode and binding to an NSManagedObjectContext. In the Cocoa Bindings Reference [1], NSManagedObjectContext is not even listed. Yet, in Interface Builder, NSObject/ArrayController can, via my App_Delegate, bind to it (although in [1] this is called "register"). Are there any examples of viewing the "many" managed objects of a given entity in a moc without an NSArrayController?

2. Can I use the filtering and sorting capabilities of the array controller? Seems wasteful not to, but...

3. If so, what key in the array controller can I observe? Issues: 'content' seems to be the only key that is KVC, but it does not change and therefore does not send observeValueForKeyPath:::: when object property changes cause a change in the sorted/filtered output. arrangedObjects seems to mostly work but is not KVC (i.e. there is no -setArrangedObjects method). Is that OK, since I'm only 'reading'?

4. What is the underlying problem with my approach which is causing these (and a few other) headaches?

Thanks!

Jerry Krinock

[1] http://developer.apple.com/documentation/Cocoa/Reference/ CocoaBindingsRef/index.html

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.