• 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: Calculating intrinsicContentSize for a NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculating intrinsicContentSize for a NSTextField


  • Subject: Re: Calculating intrinsicContentSize for a NSTextField
  • From: Jeremy Hughes <email@hidden>
  • Date: Sat, 18 Mar 2017 10:22:06 +0000

> On 18 Mar 2017, at 04:45, Daryle Walker <email@hidden> wrote:
>
>> This works, but if I remove the call to attributedStringValue (whose result is discarded) the result of the following line fails to reflect changes in the bounds of the text, and the field fails to grow or shrink.
>>
>> Presumably, calling attributedStringValue has a side effect which changes the way that cellSize:forBounds: is calculated.
>
> Looking at the “attributedStringValue” docs, "validate​Editing()” is called as the side effect.

Thanks - that works, and the documentation explains why:

"Validation sets the object value of the cell to the current contents of the cell’s editor (the NSText object used for editing), storing it as a simple NSString or an attributed string object based on the attributes of the editor.”

Jeremy


_______________________________________________

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


References: 
 >Calculating intrinsicContentSize for a NSTextField (From: Jeremy Hughes <email@hidden>)
 >Re: Calculating intrinsicContentSize for a NSTextField (From: Daryle Walker <email@hidden>)

  • Prev by Date: Re: Auto-sized table cells, for macOS
  • Next by Date: Re: programmatically tell when spotlight/mds is indexing
  • Previous by thread: Re: Calculating intrinsicContentSize for a NSTextField
  • Next by thread: NSTextFinder guide
  • Index(es):
    • Date
    • Thread