Re: how to measure an attributedString or string with attributes
Re: how to measure an attributedString or string with attributes
- Subject: Re: how to measure an attributedString or string with attributes
- From: Nick Zitzmann <email@hidden>
- Date: Wed, 16 Jul 2008 13:17:27 -0600
On Jul 16, 2008, at 6:18 AM, norio wrote:
I think QuickTime API had an api for measuring the width and the
height of an attributed string.
If width was passed as an argument, the height was returned. And if
height, returned its width.
Is there any ways to get such information?
For some reason, I was never able to get the built-in sizing methods
to work correctly. What worked for me, though, was to use
NSLayoutManager, NSTextContainer, NSTextStorage, and the -
usedRectForTextContainer: method after setting the container size and
forcing layout. If you search around, you might find some sample code.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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