Re: Force NSTextField (multiline wrapping label) to grow vertically?
Re: Force NSTextField (multiline wrapping label) to grow vertically?
- Subject: Re: Force NSTextField (multiline wrapping label) to grow vertically?
- From: Steve Mills <email@hidden>
- Date: Thu, 09 Apr 2015 13:53:18 -0500
On Apr 9, 2015, at 13:28:33, Ken Thomases <email@hidden> wrote:
>
> In a parent view, you could override the -layout method with something like this to adjust it dynamically:
>
> - (void) layout
> {
> textField.preferredMaxLayoutWidth = 0;
> [super layout]
> textField.preferredMaxLayoutWidth = NSWidth([textField alignmentRectForFrame:textField.frame]);
> [super layout];
> }
Groovy! That works like a charm. I was curious, so I commented out the first 2 lines, and it still works as expected. Do you think the reset to 0 and subsequent forced layout are necessary? Thanks again, Ken.
--
Steve Mills
Drummer, Mac geek
_______________________________________________
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