Re: NSTextField & Vertical resizing using sizeToFit
Re: NSTextField & Vertical resizing using sizeToFit
- Subject: Re: NSTextField & Vertical resizing using sizeToFit
- From: Eric Gorr <email@hidden>
- Date: Wed, 10 Nov 2010 14:58:08 -0500
Sorry...I mean NSTextField.
On Nov 10, 2010, at 2:47 PM, Eric Gorr wrote:
> I have a NSTextField 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