Re: ViewControllers and window nibs
Re: ViewControllers and window nibs
- Subject: Re: ViewControllers and window nibs
- From: David Scheidt <email@hidden>
- Date: Fri, 8 May 2009 20:03:25 -0400
On May 6, 2009, at 3:44 PM, David Scheidt wrote:
I've got a Core Data app, using the NSPersistantDocument stuff.
There are three basic entity types. There is one, which I'll call
MainEntity, which has optional to-many relationships with the other
two, which I'll call A and B. In my main window, I have a
TableView, which has its columns bound to subclass of
NSArrayController (I'm overriding setFilterPredicate, and have some
convience methods). In the bottom part of the window, there is an
area that shows details of the particular MainEntity that's selected
in the table. there is another table column which shows either the
AEntities or BEntities that the selected MainEntity has (using an
ArrayController bound to MainEntityArrayController.selection. When
I have everything in one nib, and use a TabView to control which of
the A or B tables is shown, everything works just fine. For various
reasons, I want to replace the bottom section of the window with a
set of ViewControllers. I'm at a loss trying to figure out how
properly get a reference to the MainEntityArrayController. I've put
an instance of the ArrayController in my AView.xib, and set the
viewControllers mainEntityArrayController outlet in
windowControllerDidLoadNib. It gets the right value there, but the
change in selection doesn't seem to propagate into the other view.
what am I missing?_______________________________________________
For the benefit of the archives: I'm binding to file's owner.
(Which, in this case is a ViewController.) It has a reference to the
document that the window is associated with, which knows about the
array controller. So I use a keypath of
self.theDocument.theArrayController.selection.key to get values. I
have array controllers in the sub-nibs bound to
self
.theDocument
.theArrayController.selection.relationshipThatPointsAtMySubEntities.
Other than being a big pain to type that, this seems to work fine.
(I'm getting an error [<_NSFaultingMutableSet 0x10828b0>
addObserver:forKeyPath:options:context:] is not supported. Key path:
@avg.myRating for one of the key paths, but that may be me.)
David
_______________________________________________
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