• 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: [BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value


  • Subject: Re: [BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value
  • From: Iceberg-Dev <email@hidden>
  • Date: Mon, 30 Mar 2009 21:28:58 +0200


On Mar 30, 2009, at 3:55 PM, Benjamin Stiglitz wrote:

I'm running the code below. I have a single NSWindow with a checkbox and
a button. In the awakeFromNib method of the main controller, I change the
attribute of the checkbox string. In the compute: method, I compute the
height requested to display a string for a specific font and maximum
width.


If I run this code as is, I get 17.0 as the required height. That's
incorrect.

If I comment the awakeFromNib code, I get 34.0f as the required height.
That's correct.

Is this the code exactly as it is in the app? e.g. compute: doesn't
depend in any way on the values you set in -awakeFromNib? (I think this
is your complaint, but I'm just verifying.)

Yes.

Not that this fixes your problem, but -[NSAttributedString boundingRectWithSize:options:] would probably be a
bit easier for you to use.

I tried it. It apparently does not work for multi-line text.


I should probably add that additional tests show that the bug appears in Mac OS X 10.4.11 but not in Mac OS X 10.5.6.


I also thought of a ugly workaround (strike the text with a bezier path instead of relying on the Cocoa Text Engine) but if there is a better solution, I'm still interested.


_______________________________________________

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: 
 >[BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value (From: Iceberg-Dev <email@hidden>)
 >Re: [BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value (From: Benjamin Stiglitz <email@hidden>)

  • Prev by Date: NSTableColumn's sort key in Interface Builder
  • Next by Date: Why does -[NSURLConnection start] crash?
  • Previous by thread: Re: [BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value
  • Next by thread: 2-button *vertically*-oriented UIAlertView ?
  • Index(es):
    • Date
    • Thread