• 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: Small NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Small NSTableView


  • Subject: Re: Small NSTableView
  • From: Glenn Zelniker <email@hidden>
  • Date: Fri, 27 Oct 2006 18:32:40 -0400


On Oct 27, 2006, at 6:16 PM, Mark Manes wrote:

I played a bit with Interface Builder last night. I wanted to create a smaller size (i.e. like small and mini in some controls) for the NSTableView.

I found that I could adjust the row height in pixels but of course when I do that the font no longer fits. What is the right way to have a small NSTableView?

There are a couple of ways to do this. One is to implement the - willDisplayCell:forTableColumn:row: method in the table's data-source/ delegate and set the font explicitly like this:


- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
[aCell setFont:[NSFont systemFontOfSize:11.0]]; // or pick your own font
}


Another way to do it is to have your -objectValueForTableColumn:row: method return an attributed string, like this:

- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: (NSTableColumn *)aTableColumn row:(int)rowIndex
{
return [[NSAttributedString alloc] initWithString:myString attributes:myAttributes];
}


(usual caveats about autoreleasing omitted for brevity)

HTH,

Glenn Zelniker
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Small NSTableView
      • From: "I. Savant" <email@hidden>
References: 
 >Small NSTableView (From: Mark Manes <email@hidden>)

  • Prev by Date: Re: Best practice question
  • Next by Date: Re: Seeking debugging advice
  • Previous by thread: Small NSTableView
  • Next by thread: Re: Small NSTableView
  • Index(es):
    • Date
    • Thread