NSTextView & Vertical resizing using sizeToFit
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