Hi everyone, I've been struggling for several hours to get the bounding rectangle of an NSAttributedString when drawn at a particular width.
I have an NSTextView that I need to resize dynamically. NSTextView appears to resize itself as I add text, but I also need it to shrink itself as I delete text. Here's what I've tried: [myAttributedString size] [myAttributedString boundingRectWithSize:NSMakeSize(desiredWidth, FLT_MAX) options:NSStringDrawingUsesDeviceMetrics]; [[myTextView layoutManager] usedRectForTextContainer:[myTextView textContainer]] [[myTextView layoutManager] boundingRectForGlyphRange:NSMakeRange(0, [myAttributedString length]) inTextContainer:[myTextView textContainer]] ... and a few others I've been over the documentation for NSAttributedString, NSLayoutManager, and NSTextContainer, and I've tried just about everything that looks like it might give me what I'm looking for. However, I've obviously missed something pretty fundamental to getting my string's rect. Any pointers? Thanks! Dave DeLong
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com