Reputation: 9415
I am quite new to Cocoa framework in terms of both language and framework. What is the equivalent class for creating a Tree view on Mac OS X. I am trying to port an UI on Mac OS X. In this, a tree view is used to store some names and names under them. They are being set by a function provided by me (say AddItemUnder).
How to create tree view on Mac OS X? I saw NSOutlineView. But that requires some data source. In my case, I do not have any data source.
Also, in my case, only UI related will be in Objective-C. Rest code will be in C++ and may be common for both Windows and Mac OS X.
Currently, I need tree-view where I can add items like a hierarchical tree.
Upvotes: 0
Views: 971
Reputation: 46543
In my case, I do not have any data source.
If you don't have any data, what are you going to display on OSX GUI?
I would say you certainly have a data that is called Model, and you use GUI for the View part, and to bind Model with View you need a Controller. You are given a controller called NSTreeController.
If you are not happy with TreeController, then you can go for NSMutableDictionary and go on to add objects under objects upto any level.
Something like this :
@"World":@"worldKey"
-@"Asia":@"asiaKey"
-@"India@":@"indiaKey"
-@"Bangalore:@"bangaloreKey"
-@"@"Japan":@"japanKey"
-@"Europe":@"europeKey"
-@"England":@"englandKey"
-@"OldTrafford":@"oldTraffordKey"
-@"Australia":@"australiaKey"
-@"NewSouthWales:@"newSouthWalesKey"
Upvotes: 1