A problem when you want to expand some items in an NSOutlineView programatically at application start is that the NSTreeController prepares it’s content after awakeFromNib is called on your controller.
To ensure that the data is loaded before you try to expand the items you can observe the content key on the tree controller and expand the nodes as you receive the the observeValueForKeyPath: message as shown below:
1234567891011121314151617181920212223
-(void)observeValueForKeyPath:(NSString*)keyPathofObject:(id)objectchange:(NSDictionary*)changecontext:(void*)context{if(object==treeController){// Expand the first row (which is our section header)[sourceListexpandItem:[sourceListitemAtRow:0]expandChildren:NO];[treeControllerremoveObserver:selfforKeyPath:@"content"];}}-(void)awakeFromNib{// Listen on the treeController to expand the root node // when it has prepared it's content.[treeControlleraddObserver:selfforKeyPath:@"content"options:0context:nil];}