[Solved] Images in table headers
[Solved] Images in table headers
- Subject: [Solved] Images in table headers
- From: David Sinclair <email@hidden>
- Date: Sun, 27 Oct 2002 15:05:00 -0800
I asked how to add an image to a table header. Firstly, for those who
thought I was asking about an indicator image, I apologize: I meant an
image as the title itself. Thanks to all those who replied via e-mail.
Here's the solution. This works well, and has the bonus of being able
to have a mix of images and text in the title if you wish, with minor
modification:
NSTableColumn *column = [sampleTableView
tableColumnWithIdentifier:@"Sample"];
NSFileWrapper *fileWrapper = [[[NSFileWrapper alloc]
initWithPath:[[NSBundle mainBundle] pathForResource:@"Sample"
ofType:@"tiff"]] autorelease];
NSTextAttachment *attachment = [[[NSTextAttachment alloc]
initWithFileWrapper:fileWrapper] autorelease];
NSAttributedString *string = [NSAttributedString
attributedStringWithAttachment:attachment];
[[column headerCell] setAttributedStringValue:string];
If you want to see it in action, look in the Notifiers window in the
next release of Dejal Simon (1.0b3).
--
David Sinclair, Dejal Systems, LLC - email@hidden
Let Dejal Simon keep an eye on your sites for changes or failures!
http://www.dejal.com/simon/
_______________________________________________
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.