Bounding rect for String when wrapped
Bounding rect for String when wrapped
- Subject: Bounding rect for String when wrapped
- From: email@hidden
- Date: Wed, 11 Sep 2002 01:36:53 EDT
I seem to have a problem, can anyone help me?
For my utility, I need to draw a series of Strings in columns of a fixed
with, with word wrapping; I do not want to lose any text or words.
Some of the Strings will be long and wrap to more than one lines do to
horizontal constraints, while others will have one or more returns (ie. line
feeds/carriage returns) in them, so they would always take up more than one
line.
I can use drawInRect:withAtrributes: to draw the String in a given rectangle
with word wrapping, but first I need to calculate the rectangle. I know the
width, but am having problems calculating the height.
I could use sizeWithAttributes: to find out the bounding rectangle for the
String, but that does not handle word wrapping. It would give me the vertical
height, which would be dependent on how many lines of text (with returns)
there are in the String. It would not calculate how many vertical space I
need, keeping track of both word wrap & returns.
Old TextEdit provided calls that would calculate the view, for a fixed
horizontal width, and tell you how much vertical space you need.
Is there anything similar in Cocoa that would do this?
Thanks,
Steve Sheets
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.