• 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: Setting vertical alignment for a NSTextFieldCell ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting vertical alignment for a NSTextFieldCell ?


  • Subject: Re: Setting vertical alignment for a NSTextFieldCell ?
  • From: Ryan Britton <email@hidden>
  • Date: Tue, 26 Jul 2005 15:25:34 -0700

There is no way to adjust the vertical alignment without subclassing something or getting into the ATSUI stuff. Subclassing NSTextFieldCell and overriding drawInteriorWithFrame:inView: to use an adjusted frame would be the easiest I think. The ATSUI stuff will give you far more control, but it gets to be very complex to implement anything even resembling the existing text field classes.


On Jul 26, 2005, at 2:59 PM, Adam Holt wrote:

I have an NSTableView that for one of its NSTableColumn's I have created a
new NSTextFieldCell for and assigned it with setDataCell. The purpose is to
be able to change the font size just for that column of the table.


Here's my code:

- (void)awakeFromNib
{
    NSTextFieldCell *cell;
    cell = [[NSTextFieldCell alloc] init];
    [cell setAlignment:NSCenterTextAlignment];
    [cell setFont:[NSFont fontWithName:@"Lucida Grande" size:20.0]];
    NSTableColumn *desiredColumn = [myTableView
                            tableColumnWithIdentifier:@"3"];
    [desiredColumn setDataCell:cell];
    [cell release];
}


This works as I would expect... to a point. The problem I have is that as I
use a larger font size, the text drops vertically in the cell so that it
clips at the bottom whilst there is still plenty of space between the top of
the text and the ceiling of the cell.


Is there any way I can vertically align my text?

Cheers...

Adam.


_______________________________________________ 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


_______________________________________________ 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: Setting vertical alignment for a NSTextFieldCell ?
      • From: Adam Holt <email@hidden>
References: 
 >Setting vertical alignment for a NSTextFieldCell ? (From: Adam Holt <email@hidden>)

  • Prev by Date: Re: NSTreeController drag and drop
  • Next by Date: Developing for Tiger and Panther;
  • Previous by thread: Setting vertical alignment for a NSTextFieldCell ?
  • Next by thread: Re: Setting vertical alignment for a NSTextFieldCell ?
  • Index(es):
    • Date
    • Thread