Tuesday, February 13, 2007

NSTableView in Objective-C Explained

Okay,

Lets explain a bit on the NSTextView in Objective-C Example.

The Table view basically contains a dataSource method and a Delegate Method. It looks in the code you associate with it for that tableView Method and the numberOfRowsInTableView Method. It uses this to figure out what to display and how much to display. That's it. That's all it truly does. You need those to methods and provide the code to extract your information.

Unlike Objective-C, C# does all the work for you. All you have to do in C# is put the following to show a single item:
  • listView.Items.Add(aObject);
Basically, Microsoft did all the background work for you. You have to do the background work in Objective-C.

The benefits to the Objective-C form of doing a list or table are:
  • You get more control
  • Formatting is easier
  • Don't have to fool around with a dataset to display multiple items like in Objective-C
  • You can do some pretty neat things, like add images into the table with ease.
The Downside to this is:
  • It requires some setup and prior knowledge of Objective-C or a C Based computer language.
I hope that this has helped out you mac programmers out there who are interested in writing programs in Objective-C with tables!

No comments: