• 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
Center image in NSTableView header
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Center image in NSTableView header


  • Subject: Center image in NSTableView header
  • From: Ivan C Myrvold <email@hidden>
  • Date: Thu, 15 Jan 2009 07:17:00 +0100

I am creating an NSAttributedString containing an image in an NSTextAttachment, setting an NSTableView headerCell to the attachmentCell.
This works great, the image is shown nicely on the table view column header.
But I am unable to get the image centered in the column header. Anyone have a hint to how I can do that?
Here is my code:


NSImage *warningImage = [NSImage imageNamed:@"danger"];
NSTextAttachment *ta = [[[NSTextAttachment alloc] init] autorelease];
[(NSCell *)[ta attachmentCell] setImage:warningImage];

NSAttributedString *headerAS = [NSAttributedString attributedStringWithAttachment:ta];
[[[oactiveElementsTable tableColumnWithIdentifier:@"warningword"] headerCell] setAttributedStringValue:headerAS];


Ivan
_______________________________________________

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


  • Prev by Date: Quick (?) NSCell question: getting the drawing (inner) rectangle
  • Next by Date: Re: Localized resources not loading from external frameworks
  • Previous by thread: Re: Quick (?) NSCell question: getting the drawing (inner) rectangle
  • Next by thread: completely messed up with bindings...
  • Index(es):
    • Date
    • Thread