• 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: How to get a table column header with an image instead of text?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get a table column header with an image instead of text?


  • Subject: Re: How to get a table column header with an image instead of text?
  • From: Corbin Dunn <email@hidden>
  • Date: Mon, 21 Jul 2008 08:20:32 -0700


On Jul 20, 2008, at 12:48 PM, Marc Respass wrote:


On Jul 20, 2008, at 2:05 PM, Adam R. Maxwell wrote:


On Jul 20, 2008, at 10:57 AM, Jean-Daniel Dupas wrote:


Le 20 juil. 08 à 19:54, Marc Respass a écrit :

Hi again,

I hate answering my own question but I did figure it out. I sub- classed NSTableHeaderCell then created an instance using initImageCell. Then it occurred to me that it seemed a bit silly. If I can init an image cell, maybe I can just set the cell. So, create an outlet to the column (or find it somehow) and in awakeFromNib,

NSImage *image = [NSImage imageNamed:@"CellImage"];
[[theColumn headerCell] setImage:image];

Now to figure out how to prevent the sort indicator from displaying :).

Subclass NSTableColumneHeaderCell and override

- (void)drawSortIndicatorWithFrame:(NSRect)cellFrame inView: (NSView*)controlView ascending:(BOOL)ascending priority: (NSInteger)priority

I'd try -[NSTableView setIndicatorImage:inTableColumn:] passing nil for the indicator image first.

Thank you both.

[[indicatorColumn tableView] setIndicatorImage:nil inTableColumn:indicatorColumn];

still displays the image. I imagine it uses the default (clearing your potential custom image) if you pass nil. However, it seems like a hack but the column is narrow. If it is resized to fit the image in the column header, then the indicator image does not show. In fact, I can simply set the column to not be resizable and invoke sizeToFit which sizes it perfectly.

I don't recommend that approach; it is taking advantage of the fact that there isn't enough room to show both.


The proper way to hide the sort indicator is to make sure you don't have a sortDescriptorPrototype set (sort key/ selector in IB) and turn column selection off.

corbin_______________________________________________

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


References: 
 >How to get a table column header with an image instead of text? (From: Marc Respass <email@hidden>)
 >Re: How to get a table column header with an image instead of text? (From: Marc Respass <email@hidden>)
 >Re: How to get a table column header with an image instead of text? (From: Jean-Daniel Dupas <email@hidden>)
 >Re: How to get a table column header with an image instead of text? (From: "Adam R. Maxwell" <email@hidden>)
 >Re: How to get a table column header with an image instead of text? (From: Marc Respass <email@hidden>)

  • Prev by Date: Creating multiple popup window
  • Next by Date: Re: Being notified of changes to a file
  • Previous by thread: Re: How to get a table column header with an image instead of text?
  • Next by thread: looking for help with http post example
  • Index(es):
    • Date
    • Thread