mechanism for "conditional binding" depending on class of selection
mechanism for "conditional binding" depending on class of selection
- Subject: mechanism for "conditional binding" depending on class of selection
- From: Eric Miller <email@hidden>
- Date: Sun, 15 Jan 2006 15:59:54 -0700
Hi -
I'm seeking advice for the "right" way to do something, or if there's
a mechanism for doing what I need already in place.
My data model is basically an array of subclasses of some base class
(call it Node). The subclasses (RemoteNode, LocalNode, etc) may all
have different data fields in addition to the base class' fields. I
have a master-detail type interface. I want the inspector pane to
change automatically depending on the subclass of Node currently
selected.
That part is working, but I find that the views associated with Node
types that *aren't* currently selected — they're invisible — are still
trying to pull new values from the new selection, resulting in
exceptions saying "Blahblah is not key-value coding compliant for the
key yadda yadda."
So if RemoteNode has a url field and its inspector shows this, then
when a LocalNode (which does not have a url field) is selected, the
RemoteNode's url field throws since the selection has changed, but
nodeController.selection.url does not exist. Make sense?
Ideally, I'd like to bind the views to the data model conditionally.
Even more ideally, the condition would include access to the class of
the controller's selection in IB. Maybe that's asking a lot. =)
Anyway, it seems like there should be some elegant way to do this, but
I can only come up with kind of ugly ways to do it.
TIA for advice.
Eric Miller
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden