• 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: Metrics for a NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Metrics for a NSTextField


  • Subject: Re: Metrics for a NSTextField
  • From: Michael Ash <email@hidden>
  • Date: Thu, 26 Feb 2009 11:10:49 -0500

On Thu, Feb 26, 2009 at 10:49 AM, Eric Gorr <email@hidden> wrote:
> Unfortunately, sizeToFit does not work.
>
> It doesn't appear one can constrain the width of a NSTextField and only have
> it's height adjustable. Basically, sizeToFit provides a size that causes the
> text in the field to fit on a single line.

Try sending -cellSizeForBounds: to your NSTextFieldCell. Give it a
bounds with the correct width but a very tall height, and it should
keep that width (or reduce it) and give you the appropriate height
with wrapping.

Mike
_______________________________________________

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

  • Follow-Ups:
    • Re: Metrics for a NSTextField
      • From: Eric Gorr <email@hidden>
References: 
 >Metrics for a NSTextField (From: Eric Gorr <email@hidden>)
 >Re: Metrics for a NSTextField (From: Eric Gorr <email@hidden>)
 >Re: Metrics for a NSTextField (From: Eric Gorr <email@hidden>)
 >Re: Metrics for a NSTextField (From: Eric Gorr <email@hidden>)

  • Prev by Date: Re: One IBAction, multiple results from multiple methods
  • Next by Date: Re: One IBAction, multiple results from multiple methods
  • Previous by thread: Re: Metrics for a NSTextField
  • Next by thread: Re: Metrics for a NSTextField
  • Index(es):
    • Date
    • Thread