Re: Bindings / NSTableView (limitation ?)
Re: Bindings / NSTableView (limitation ?)
- Subject: Re: Bindings / NSTableView (limitation ?)
- From: "Daniel Angermeier" <email@hidden>
- Date: Wed, 27 Jun 2007 19:42:58 +0200
Great, Thanks!
This does exactly what I was trying to do.
Does this cause any significant performance hit, or is it negligible ?
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell
forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
id item= [myArray objectAtIndex:rowIndex];
if([[item objectForKey:@"mark"] boolValue])
{
if([aCell respondsToSelector:@selector(setTextColor:)])
[aCell setTextColor:[NSColor redColor]];
}
else
{
if([aCell respondsToSelector:@selector(setTextColor:)])
[aCell setTextColor:[NSColor blackColor]];
}
}
On 6/27/07, I. Savant <email@hidden> wrote:
On 6/27/07, Daniel Angermeier <email@hidden> wrote:
> I would like to dinamically change the color of particluar rows in a
> table view, depending on app state.
> Before I was using the table view data source approach,
> and this was failrly easy to do,
> by just returning a stringWithAttributes in
It's a better idea to use the NSTableView delegate method
-tableView:willDisplayCell:forTableColumn:row: for this sort of thing,
but in general, Bindings and datasource/delegate methods can (and
sometimes must) be intermingled.
Google around for -tableView:willDisplayCell:forTableColumn:row:
examples; there're plenty.
--
I.S.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden