Re: Calculating intrinsicContentSize for a NSTextField
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, "validateEditing()” 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