• 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
NSTextView & Vertical resizing using sizeToFit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView & Vertical resizing using sizeToFit


  • Subject: NSTextView & Vertical resizing using sizeToFit
  • From: Eric Gorr <email@hidden>
  • Date: Wed, 10 Nov 2010 14:47:54 -0500

I have a NSTextView and I would like it to calculate for me how tall it needs to be to contain the string I assigned to it. I have set the width to 200  pixels and the initial height of the field to CGFLOAT_MAX. I then do:

		[[theField cell] setLineBreakMode:NSLineBreakByWordWrapping];
		[[theField cell] setWraps:YES];
		[theField sizeToFit];

However, when I get the frame back again, it has resized it in the horizontal direction only. Now, I believe calling setLineBreakMode and setWraps is redundant, but I am still clearly missing something that would cause the control to resizing vertically instead of horizontally. What am I missing?

Thank you.


_______________________________________________

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:
    • NSTextView vs NSTextField
      • From: Eric Gorr <email@hidden>
    • Re: NSTextField & Vertical resizing using sizeToFit
      • From: Eric Gorr <email@hidden>
  • Prev by Date: Re: Moderator - Re: iPad 4.2 (deploy to 3.2.2) error
  • Next by Date: Re: NSTextField & Vertical resizing using sizeToFit
  • Previous by thread: RE: Moderator - Re: iPad 4.2 (deploy to 3.2.2) error
  • Next by thread: Re: NSTextField & Vertical resizing using sizeToFit
  • Index(es):
    • Date
    • Thread