PDA

View Full Version : NSTreeController allObjects?




BollywooD
Sep 20, 2009, 02:49 AM
how do I return an NSArray of all the root objects in my NSTreeController?
this should be simple?

this is the code I have tried....

NSArray *myArray = [[self myTreeController] allObjects];


and this:

NSArray * myArray = [myTreeController content];

Im stumped....



BollywooD
Sep 20, 2009, 05:23 AM
Doh!

NSMutableArray * myArray = [NSMutableArray array];
for (id node in [myTreeController content])
{
[myArray addObject:[node valueForKey:@"key"]];
}
return myArray;