Re: Core Data right for my project? (Core Data and NSTreeController)
Re: Core Data right for my project? (Core Data and NSTreeController)
- Subject: Re: Core Data right for my project? (Core Data and NSTreeController)
- From: Keith Blount <email@hidden>
- Date: Sun, 19 Jun 2005 01:24:48 -0700 (PDT)
Sorry to reply to my own message, but I forgot to
mention: for the second problem listed below, it did
occur to me that I could use mmalc's technique in his
FilteringArrayController, by subclassing
NSTreeController and overriding -arrangeObjects: so
that it returned only objects that have isFolder set
to YES for my folder-only outline view. One big
problem: NSTreeController doesn't have an
-arrangeObjects: method... I seem to be hitting walls
every way I turn with NSTreeController.
Cheers,
Keith
--
FROM : Keith Blount
DATE : Sun Jun 19 09:52:33 2005
Many thanks for your reply - the link at the bottom of
your mail was helpful, and your tutorials on
CocoaDevCentral have been invaluable. There are still
two issues that are confounding me:
1)
>> and the fact that using Core Data with
NSTreeController means that
>> you cannot use NSOutlineView's datasource
persistent state methods
> Why would you need to if using Core Data?
What I mean by this are NSOutlineView's datasource
methods -outlineView:itemForPersistentObject and
outlineView:persistentObjectForItem which save the
state of the outline view - which items are expanded
etc. I can't find any way of getting this to work
using Core Data and NSTreeController, and I don't see
how using Core Data makes this unnecessary. Someone
suggested iterating through the items and saving their
state manually, but surely this involves more code
rather than less, and also, I don't want to save the
state inside the project file - I just want the
behaviour of the datasource methods.
2) I'm a little confused on how to set it up in the
way I want: the outline view should be based on an
array of items of a custom class. The custom class
should have an isFolder BOOL that is set depending on
how an instance is created. If isFolder is YES, the
node can be expanded and have children added to it. If
NO, it can't. I also was another outline view that
displays ONLY objects with isFolder set to YES. Is
this possible using Core Data?
Many thanks again for the help. Sorry if these seem
basic questions, but after a year of learngin and
using Cocoa I was just feeling like I was getting the
hang of it, and now with Core Data I feel like I'm
starting all over again.
Thanks again,
Keith
FROM : Scott Stevenson
DATE : Sat Jun 18 18:30:51 2005
On Jun 17, 2005, at 1:00 PM, Keith Blount wrote:
> I know that Core Data could probably do a lot of
this fairly
> easily, but there are issues such as having to use
undocumented API
> methods such as -observedObject in order to support
variable row
> heights
That's the only one you need to use, and it's pretty
low risk.
> and the fact that using Core Data with
NSTreeController means that
> you cannot use NSOutlineView's datasource persistent
state methods
Why would you need to if using Core Data?
> there are a *lot* of workarounds required at the
moment as I
> understand it.
Hmmm, I don't really think so. The -observedObject is
the only one
that occurs to me, and it's one line of code.
> My question is: if you are starting a project and
are happy only to
> target Tiger and above only, should you be using
Core Data for most
> projects
I think so. It saves you a lot of manual labor. Core
Data isn't right
for every imagineable project, but it sounds like
yours deal with
management of a lot of individual objects. Core Data
excels at this.
- Scott
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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