• 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: Trouble finding bounding rect of NSAttributedString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble finding bounding rect of NSAttributedString


  • Subject: Re: Trouble finding bounding rect of NSAttributedString
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 19 Nov 2009 15:28:01 -0800

On Nov 19, 2009, at 2:39 PM, Dave DeLong wrote:

> When I print out the size or rect that these return, I invariably get either {0, 0} or something absurd like {{1.17076e-318, 2.29357e-314}, {2.30359e-314, 2.1224e-314}} (that's just running the rect through NSStringFromRect())

Make sure the receiver (the NSAttributedString) isn't nil. The Obj-C runtime gives undefined results for a struct-based method return value if the receiver is nil; so you'll end up with garbage like this. (This is because it doesn't know at runtime how large the struct is, so it can't safely fill it in with zeroes.)

Put in something like NSAssert(str!=nil, @"str is nil"); before the call.

—Jens_______________________________________________

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

  • Follow-Ups:
    • Re: Trouble finding bounding rect of NSAttributedString
      • From: Dave DeLong <email@hidden>
References: 
 >Trouble finding bounding rect of NSAttributedString (From: Dave DeLong <email@hidden>)
 >Re: Trouble finding bounding rect of NSAttributedString (From: Jens Alfke <email@hidden>)
 >Re: Trouble finding bounding rect of NSAttributedString (From: Dave DeLong <email@hidden>)

  • Prev by Date: Re: How to change TCP / IP settings using Cocoa
  • Next by Date: RE: NSRunloop + shared thread
  • Previous by thread: Re: Trouble finding bounding rect of NSAttributedString
  • Next by thread: Re: Trouble finding bounding rect of NSAttributedString
  • Index(es):
    • Date
    • Thread