On Apr 20, 2008, at 11:37 AM, Manfred Schwind wrote:
Getting the height of a text for a given width is easy and I've done
that countless times.
Also getting the width of a string (layed out in one line if it has
no newlines) is no problem.
But I have a different problem. I try to give an
Now I want to be able to calculate the optimal width of the view so
that the entire text is visible.
This worked wonders for me:
http://www.cocoabuilder.com/archive/message/cocoa/2008/3/31/202752
This also does not solve my problem.
Getting the height of a text for a given width is easy and
If you wish to vary both the width and height to be a more pleasing set of
dimensions, similar to what an alert does, try word wrapping your text into a
golden ratio rectangle using the area measurement generated by your single-line
text measurement. Of course, based on a strict interpretation