• 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
Re: Custom NSTableView column headers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom NSTableView column headers


  • Subject: Re: Custom NSTableView column headers
  • From: Frank Midgley <email@hidden>
  • Date: Fri, 27 Feb 2004 18:32:21 -0600

On Feb 27, 2004, at 5:47PM, Dylan Barrie wrote:

Hey, all. I'm trying to make a custom NSTableView header cell class that can display an image instead of the normal text that is displayed by the default header cell. Look at Mail.app's two left-most columns for an idea of what I'm attempting. Now, I've gotten the cell itself pretty much working, but there is an additional side effect that I have not been able to rid myself of. Check out this screenshot:

http://postpose.com/dbarrie/columns.jpg

The blue-highlighted lock column is the column whose header cell I've replaced with my custom one (that draws the lock icon), but, this same cell is also being used to draw the "empty" space next to the lock column! This area should be blank, there should not be a lock there! Anyone have any ideas as to what I can do to fix this?

You may be shooting for something more capable than this but you can display an image using the standard header cell. Just create an attributed string containing an image and put it in the header cell. You could add something like the following to your -awakeFromNib:

NSImage *headerImage = [NSImage imageNamed:@"Attachments Icon"];
NSTextAttachment *ta = [[[NSTextAttachment alloc] init] autorelease];
[(NSCell *)[ta attachmentCell] setImage: headerImage];
NSAttributedString *headerAS = [NSAttributedString attributedStringWithAttachment:ta];
[[[tableView tableColumnWithIdentifier:@"Attachments"] headerCell] setAttributedStringValue: headerAS];

-Frank

------------------------------------
Frank M. Midgley
email@hidden
http://homepage.mac.com/knarf/
_______________________________________________
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.


References: 
 >Custom NSTableView column headers (From: Dylan Barrie <email@hidden>)

  • Prev by Date: Re: NSCollectionConroller ?
  • Next by Date: Re: Array Operators & array controllers
  • Previous by thread: Custom NSTableView column headers
  • Next by thread: Array Operators & array controllers
  • Index(es):
    • Date
    • Thread