Re: Displaying a table entry in Bold
Re: Displaying a table entry in Bold
- Subject: Re: Displaying a table entry in Bold
- From: Brian Webster <email@hidden>
- Date: Fri, 19 Apr 2002 13:41:51 -0500
On Friday, April 19, 2002, at 01:03 PM, cocoa-dev-
email@hidden wrote:
So I have a standard table with a data source set up, passing
strings to
the table for displaying, and I would like to selectively display some
of the table rows in bold. Does anyone know how to do that?
Yes.
-(id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row
{
id objectValue = nil;
NSString *string = [self getTheStringToDisplayInThisCell];
if(iWantToDisplayThisStringAsBold)
{
objectValue = [[NSMutableAttributedString alloc]
initWithString:string];
[objectValue applyFontTraits:NSBoldFontMask
range:NSMakeRange(0, [string length])];
[objectValue autorelease];
}
else
objectValue = string;
return objectValue;
}
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.