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

> 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.)

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


Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)

Help/Unsubscribe/Update your Subscription:

This email sent to maillists@xxxxxxxxx