Re: NSTableView
Re: NSTableView
- Subject: Re: NSTableView
- From: mmalcolm crawford <email@hidden>
- Date: Mon, 27 May 2002 13:16:58 -0700
On Monday, May 27, 2002, at 12:52 PM, Allan Odgaard wrote:
On mandag, maj 27, 2002, at 08:29 , mmalcolm crawford wrote:
If I had a table that had a list of names in it and I wanted all the
names that contained a 'd' to appear red instead of black like the
rest of the names. [...]
It has already been answered, but IMHO the nice solution is simply to
return an NSAttributedString which contain the colour code.
Oh absolutely, that would work too.
The utility may depend, however, on what data it is that you're
presenting -- if dates or numbers, for example, you might be taking
advantage of a formatter associated with the table column...
Further, this approach may make the
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row
method more complex: in many situations the easiest way to implement
this is using key-value coding (e.g.
return [[array objectAtIndex:row]
valueForKey:[tableColumn identifier]];
). If you have to check the column's identifier and create the
attributed string each time, the code becomes less straightforward.
My main intent, though, was to show that you certainly do not need to
create special cell subclasses.
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.