NSTreeController allObjects?

Discussion in 'Mac Programming' started by BollywooD, Sep 20, 2009.

  1. BollywooD macrumors 6502

    BollywooD

    Joined:
    Apr 27, 2005
    Location:
    Surfers Paradise
    #1
    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....

    Code:
    NSArray *myArray = [[self myTreeController] allObjects];
    
    and this:

    Code:
    NSArray * myArray = [myTreeController content];
    Im stumped....
     
  2. BollywooD thread starter macrumors 6502

    BollywooD

    Joined:
    Apr 27, 2005
    Location:
    Surfers Paradise
    #2
    Doh!

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

Share This Page