NSTextView Bad Behavior
NSTextView Bad Behavior
- Subject: NSTextView Bad Behavior
- From: Gordon Apple <email@hidden>
- Date: Mon, 14 Dec 2009 12:50:47 -0600
- Thread-topic: NSTextView Bad Behavior
Apparently, I'm not the only one who has experienced this. NSTextView (or
NSLayoutManager) is lazy. It does stuff in the background that is driving
me nuts. I need to do a full layout, not just what's visible, so I can get
a reliably accurate measure of the total physical text layout length. I've
tried the usual suspects such as scrollRangeToVisible and the
docs-recommended glyphRangeForTextContainer, all to no avail, in an attempt
to get an immediate full layout. I've even put in timer delays before
measuring it. Unfortunately, NSTextView comes back into play sometime later
and does a re-layout, often increasing the text frame height by as much as
50%, totally screwing up what I am doing. Manually scrolling to the end and
back will trigger another (correct) layout. However, because I'm often
(programmatically) replacing the displayed text, I need to accomplish this
programmatically before asking for the text frame height.
Any ideas on how to force a full layout and then prevent NSTextView from
further mucking with it?
_______________________________________________
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