pierocampanelli
pierocampanelli

Reputation: 948

Object Model for folders and Subfolders in an NSOutlineView

I have a datastucture in my app containing folders as a flat array structure as the following

/FolderA/folderB
/FolderA
/FolderC/folderD
/FolderC
/FolderF

and so on. I want to use this data as a datasource of a structured NSOutlineView. Final tree should be represented as the following:

/FolderA/
    folderB
/FolderC/
    folderD
/FolderC
/FolderF

a classical structured tree view.

Any idea on how to model this ? Keep in mind that my data is already in my application and it is stored in a flat array.

thank you

Upvotes: 2

Views: 104

Answers (1)

adc
adc

Reputation: 437

Look into NSTreeController, and setting up your models that represent your nodes with appropriate keyPaths. Core data example: http://jonathandann.wordpress.com/2008/05/13/nstreecontroller-and-core-data-sorted/

Upvotes: 3

Related Questions