• 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: how to measure an attributedString or string with attributes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >how to measure an attributedString or string with attributes (From: norio <email@hidden>)

  • Prev by Date: Re: Handling key equivalents in a controller class?
  • Next by Date: CGWindowListCreateImage - Offscreen?
  • Previous by thread: Re: how to measure an attributedString or string with attributes
  • Next by thread: Relaunch Finder (without AppleScript)
  • Index(es):
    • Date
    • Thread