• 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: Force NSTextField (multiline wrapping label) to grow vertically?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Force NSTextField (multiline wrapping label) to grow vertically?
      • From: Ken Thomases <email@hidden>
References: 
 >Force NSTextField (multiline wrapping label) to grow vertically? (From: Steve Mills <email@hidden>)
 >Re: Force NSTextField (multiline wrapping label) to grow vertically? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: objc_msgSend() selector name: tableView:objectValueForTableColumn:row:
  • Next by Date: Does GCD auto-limit concurrent tasks to number of cores?
  • Previous by thread: Re: Force NSTextField (multiline wrapping label) to grow vertically?
  • Next by thread: Re: Force NSTextField (multiline wrapping label) to grow vertically?
  • Index(es):
    • Date
    • Thread