Re: NSTreeController and Core Data
Re: NSTreeController and Core Data
- Subject: Re: NSTreeController and Core Data
- From: "Marcus S. Zarra" <email@hidden>
- Date: Thu, 21 Jul 2005 10:08:26 -0600
Tristan,
I have solved part of the mystery surrounding core data + NSTreeController.
Basically the TreeController likes having a single type of data. Therefore
in my parent child relationship, I had them all extend from a base abstract
class. That abstract class has two methods:
- (BOOL)isLeaf;
- (NSArray *)allChildren;
In the base class isLeaf returned NO and allChildren returned nil. Then my
Parent class overrode the allChildren and my leaf class overrode the isLeaf.
Then I connected the NSTreeController to the base class setting everything
up in the attributes window as appropriate.
Works great when connected to my NSBrowser. The only issue now is that when
I call [NSTreeController selectedObjects] I get an empty array back so I am
unable to retrieve the selection.
Hope this helps with your project Tristan.
Marcus
P.S. Copied to the list for others who may run into this issue in the
future.
On 7/12/05, Tristan O'Tierney <email@hidden> wrote:
>
> hey there,
>
> i made a similar post. (well, the lack of documentation on core data +
> nstreecontroller). please let me know if you get anywhere!
>
> On 7/12/05, Marcus S. Zarra <email@hidden> wrote:
>
> > I am trying to set up an NSBrowser to read data from an
> > NSTreeController that is linked to a CoreData ManagedObjectContext and
> > am running into a lack of documentation.
> >
> > Hopefully someone out there has worked in this area and can give me a
> > couple of pointers :)
> >
> > I have a data model set up as follows:
> >
> > Group Entity
> > ------------------
> > parent <--------->> Group
> > children <<--------> Group
> > items <-------->> Items
> >
> > Item
> > ----------------
> > group <<---------> Group
> >
> > I have bound the NSTreeController in Interface Builder to the
> > ManagedObjectContext but I am honestly at a loss as to where to go
> > next.
> >
> > Thanks for any help.
> >
> > Marcus S. Zarra
> >
>
_______________________________________________
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