To get all the nodes in the tree I do a depth-first search (10.5
only). Add the first method in an NSTreeNode category and the second
to a category on NSTreeController.
// NSTreeNode_Extensions
- (NSArray *)descendants;
{
NSMutableArray *array = [NSMutableArray array];
for
Jonathan, thank you for the excellent example on working with the
containers. That will certainly be useful.
On May 31, 2008, at 02:57:36, Jonathan Dann wrote:
If you're using Core Data, can't you fetch all your managed objects
and determine the one with the max vaule?
Well, I would
Well, I would have thought so, but I don't know enough about
CoreData to actually get at the objects without the tree controller.
I would've thought I could do that just off the tree controller,
using @max, too.
1 - Create a fetch request for your desired entity.
2 - Create a sort
On May 31, 2008, at 12:05:58, I. Savant wrote:
1 - Create a fetch request for your desired entity.
2 - Create a sort descriptor for the key whose max value you're
interested in.
3 - Set the fetch request's sort descriptor to the above.
4 - Create any predicates needed for filtration (ie,
On 31 May 2008, at 19:47, Rick Mann wrote:
Jonathan, thank you for the excellent example on working with the
containers. That will certainly be useful.
You're welcome, but I apologise, I forgot the -rootNodes method that
one of the tree controller methods I sent you calls! This method
Wow, really? No way to just get at all the items in the tree
controller with some key path, then use @max? It seems that this
would be possible with an NSArray:
In addition to Jonathan's comments, to be fair, you did ask, ... I
don't know enough about CoreData to actually get at the
On 31 May 2008, at 21:43, Rick Mann wrote:
Can category methods act as KVC properties?
Yep, the -flattenedObjects method I gave you asks the array of tree
nodes valueForKey:@descendants. -descendants was the NSTreeNode
method I posted.
Jon
smime.p7s
Description: S/MIME