Re: Attributed strings - and bounding rects
Re: Attributed strings - and bounding rects
- Subject: Re: Attributed strings - and bounding rects
- From: Alex Zavatone <email@hidden>
- Date: Fri, 03 Mar 2017 18:57:24 -0600
Isn't this where we set the mask so that the image is not bound by the rect?
On Mar 3, 2017, at 7:18 AM, Peter Hudson wrote:
> Hi All
>
> I have done the following to try to determine the rect required to draw an attributed string( and thus the height of a row in a table view - on MacOS )
>
> I am trying to constrain my column width to 60 - and let the possible height of the row be a max of 1000.
>
>
> let aString = anAttributedString
> let constrainedSize = NSMakeSize(60.0, 1000.0)
> let optns = NSStringDrawingOptions.usesFontLeading
> let cntxt = NSStringDrawingContext()
> cntxt.minimumScaleFactor = 1.0
>
> let aRect = aString?.boundingRect(with: constrainedSize, options: optns, context: cntxt)
>
>
>
> After the call to boundingRect, aRect has its width set to 60 and its height set to 18.
>
> This is not however correct for the contents of the attributed string - I would expect the height to be at least 200 or so with the width constrained to 60.
>
> Any help gratefully received.
>
> Peter
>
>
>
> _______________________________________________
>
> 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
_______________________________________________
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