core data + bindings + custom view ?
core data + bindings + custom view ?
- Subject: core data + bindings + custom view ?
- From: email@hidden
- Date: Thu, 13 Nov 2008 10:10:47 -0500
heres a little more detail:
I have an NSControl subclass that maintains a list of cells, and an
NSMutableArray called "content". I have
successfully bound its "content" to the core data based array
controller's "arrangedObjects" array. I thought that was all I needed
to do to get bindings working, so I made my setContent: accessor
method so that it kept my cell list updated with the content list...
this did not work. my setContent accessor was called once, during the
initialization phase of the app.
next, I tried registering for KVO on the array controller's
"arrangedObjects" value, thinking that... since it is an array, it IS
a "to many" relationship, and I would not only get alerts to changes
to the array, but also information about the changes, in the change
dictionary under the "NSKeyValueChangeKindKey" key. This sort of
worked. I get a notification when the ArrangedObjects is altered, but
the information about the change is NOT in evidence. Apparently, this
is not a "to many" relationship after all? (ummm... what??!!?!? is
this true?) And isn't this KVO a little redundant anyway? doesn't
bindings do this already? isn't there some way for me to automatically
get notified BECAUSE "content" is bound to the array controller?
(which is what I was trying to do with the setContent: method)
currently, I am thinking that I will have to discover the changes
myself, by comparing my content against my cells. it seems a bit
redundant (read: wasteful), but that seems to be the order of the
day... do everything twice.
so in all of this, i am frantically looking for ANY documentation that
explains how to duplicate any part of something I see and use every
day... namely the smooth interaction between a custom UI element (that
works SORT of like a tableview, in that it displays a list of things)
and an array controller that happens to use core data for its
content. The official apple docs, are... anemic at best, and my
google searches have come up empty.
it seems from my worm's eye view, that what I am trying to accomplish
SHOULD not be this difficult, nor this kludgey, I really feel like I
am missing something important, but try as I might, the documentation
falls extremely short of being helpful.
thanks guys,
-eblu
_______________________________________________
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