开发者

Show more than one Object in a NSTableView row

I'm new here at stackoverflow :) But I think, this is the right place to ask my question. I'm a new developer with Cocoa and Objective-c & I'm trying to write my first App for Mac: a ToDo App.

At this moment, i can开发者_运维问答 save ToDo's and delete them, but now, I want to add some features like CreationDate, some Tags (in mutablearray), and if the ToDo is finished or not. Im not working with an ArrayController, I'm saving the encoded NSMutableArray into a File (Library/Application Support/AppName) and reading it from there.

This all must be in one Row, because it is looking Like this:

Current appearance http://img683.imageshack.us/img683/7595/bild2ss.png

Where Title is, should be the Content of the ToDo, where the Blue Box is, should be the Status (Blue = undone, Grey = Done) and where Subtitle is should be the Date and the Tags (03.01.2009 - tag1, tag2, tag3)

I now how to addObjects into an mutablearray but, if i wanna save all this 4 informations into this array, i dont know how to make this.

I've got an Model, which is initializing with this 4 infomations, but how to save this? Must I save this for informations in one array and this array in my mutablearray?


The solution is actually the opposite: Have one object per row.

This is where your model layer (the M in MVC) comes in: The object for each row is a model object, an instance of a class you construct, and the icon, title, and subtitle are properties of that object.

Then, make a custom cell for your table column to display the model object in that way. The cell is part of the View layer—the V in MVC.

The C in MVC sits in between the Model and View: It's the object that owns the model and is the data source (whether by Bindings or not) of the table view. The table view gets the model objects from this object to feed them to the cell. This middle object is a Controller.


Now i have it!

I've only one Cell for the Content with an ArrayController.

I'm setting the other Informations with -(id)init for each row.

There are 3 Objects: content, status and date, and for each status i display another image (done, undone, ...).

Thank you very much for your Help! I'm trying to finish the Beta for everyone :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜