• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[Solved] Images in table headers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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.

  • Prev by Date: [more coherent info] Re: Focus ring around NSTextField
  • Next by Date: Re: [ANN] Cocoa Developer Meeting Place
  • Previous by thread: Re: Promised Drags/Spring-Loaded Folders: Buggy in 10.2?
  • Next by thread: Re: Splash Screen
  • Index(es):
    • Date
    • Thread