NSTableDataSource
NSTableDataSource
- Subject: NSTableDataSource
- From: Robert Goldsmith <email@hidden>
- Date: Thu, 4 Oct 2001 01:58:59 +0100
Hi :)
I am trying to get a custom NSCell to work in an NSTableView. I can
get it working using the following:
create a class that is the delegate for the tableview and it's data source
on awakeFromNib in this class, use setDataCell to specify my NSCell subclass
Use tableView:willDisplayCell:forTableColumn:row: to set the values
in the passed cell before it is rendered.
However, I am wondering if a)this is the best way and b)what is the
best way to store the details for each cell.
each cell has 3 text strings and an icon.
I was wondering if it was possible to store an array of my NSCell
subclass instances and simply tell the TableView to use one of these
instances (which has all its values setup already) using something
like tableView:objectValueForTableColumn:row:. However, it seems this
method expects back an NSString.
Is my only option to set the values of NSCell instances as they are
needed by copying across values from another array (maybe of
dictionary objects) whenever the cell needs to be redrawn? As
TableView does not cache, this seems like a lot of processing.
Or, is there a way to give TableView the actual object you wish
rendered and let it call the objects rendering methods? That way, you
could keep your own array of the objects, update them as needed, sort
them etc. and not have to copy stuff all over the place.
Robert
--
Please note the new email address:
email@hidden