If you are going to use a data hierarchy, then use a data hierarchy. Look like you are attempting to use a linear array, which won¹t work. You need arrays of arrays and you bind the tree controller to the root array.
On 6/10/15 10:45 PM, "[email protected]" <[email protected]> wrote: > Hi All, Is there any documentation available on NSTreeController other than > the Reference Manual? I¹ve found confusing and contradictory comments on > NSTreeController and I¹d like clarification if possible. I¹m confused about > how Index Paths are used. I have a ViewController that is uses a NIB based > Outline View and Tree Controller, it is based on the SourceView project. This > works fine, but now I¹ve got to add some data to another section. I have flat > array of ID Strings that represent objects in a Hierarchy, these take the > form: RootContainer RootContainer ~ContainerA RootContainer ~ContainerB > RootContainer ~ContainerA~LeafA RootContainer ~ContainerA~LeafB RootContainer > ~ ContainerB ~LeafA RootContainer ~ ContainerB ~LeafB The Array is sorted so > that the lowest items in the Hierarchy appear in the list first. For instance > for the above ID array, I would create: Root Node (Container) Index Path n > (the next available section in the Root) ContainerA Index Path :n.0 > ContainerB Index Path :n.1 LeafA Index Path :n.0.0 LeafB Index > Path :n.0.1 LeafA Index Path :n.1.0 LeafB Index Path :n.1.1 I am > using "insertObject: atArrangedObjectIndexPath:" to Insert Objects into the > Tree. My confusion lies in how to compute the Index Paths. I had thought to > scan the ViewController/TreeController ³ContentArray² to find the initial > Index Path, but is this safe? I other words does the position of a Node in the > ³ContentArray² Hierarchy correspond to the position I need to pass to " > insertObject: atArrangedObjectIndexPath:² ? The only other way I can see of > doing it would be to use the TreeController¹s ³Current Selection² Methods, but > they are quite cumbersome to use and seem to slow it down a *lot*, so I¹d > rather avoid doing it this way if possible. Thanks for any help or > suggestions. All the Best Dave _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
